Rxjs-filtering-operator-distinct

提供:Dev Guides
移動先:案内検索

RxJS-フィルタリングオペレーター

この演算子は、前の値と比較したときに異なるソースオブザーバブルのすべての値を提供します。

構文

distinct()

戻り値

異なる値を持つオブザーバブルを返します。

import { of } from 'rxjs';
import { distinct } from 'rxjs/operators';

let all_nums = of(1, 6, 15, 1, 10, 6, 40, 10, 58, 20, 40);
let final_val = all_nums.pipe(distinct());
final_val.subscribe(x => console.log("The Distinct values are "+x));

出力

個別の演算子