跳至主要內容

新的集合方法

大约 2 分钟featurees-proposalmissing-example

新的集合方法open in new window

模块

类型

interface Set<T> {
  addAll(...args: Array<T>): this;
  deleteAll(...args: Array<T>): boolean;
  every(
    callbackfn: (value: T, key: T, target: Set<T>) => boolean,
    thisArg?: any
  ): boolean;
  filter(
    callbackfn: (value: T, key: T, target: Set<T>) => boolean,
    thisArg?: any
  ): Set<T>;
  find(
    callbackfn: (value: T, key: T, target: Set<T>) => boolean,
    thisArg?: any
  ): T;
  /**@param separator @default "," */
  join(separator: string): string;
  map<U>(
    callbackfn: (value: T, key: T, target: Set<T>) => U,
    thisArg?: any
  ): Set<U>;
  reduce<U>(
    callbackfn: (memo: U, value: T, key: T, target: Set<T>) => U,
    initialValue?: U
  ): U;
  some(
    callbackfn: (value: T, key: T, target: Set<T>) => boolean,
    thisArg?: any
  ): boolean;
}

interface Map<K, V> {
  deleteAll(...args: Array<K>): boolean;
  every(
    callbackfn: (value: V, key: K, target: Map<K, V>) => boolean,
    thisArg?: any
  ): boolean;
  filter(
    callbackfn: (value: V, key: K, target: Map<K, V>) => boolean,
    thisArg?: any
  ): Map<K, V>;
  find(
    callbackfn: (value: V, key: K, target: Map<K, V>) => boolean,
    thisArg?: any
  ): V;
  findKey(
    callbackfn: (value: V, key: K, target: Map<K, V>) => boolean,
    thisArg?: any
  ): K;
  includes(searchElement: V): boolean;
  keyOf(searchElement: V): K;
  mapKeys<L>(
    mapFn: (value: V, index: K, target: Map<K, V>) => L,
    thisArg?: any
  ): Map<L, V>;
  mapValues<W>(
    mapFn: (value: V, index: K, target: Map<K, V>) => W,
    thisArg?: any
  ): Map<K, W>;
  merge(...iterables: Array<Iterable<[K, V]>>): this;
  reduce<T>(
    callbackfn: (memo: T, value: V, key: K, target: Map<K, V>) => T,
    initialValue?: T
  ): T;
  some(
    callbackfn: (value: V, key: K, target: Map<K, V>) => boolean,
    thisArg?: any
  ): boolean;
  update(
    key: K,
    callbackfn: (value: V, key: K, target: Map<K, V>) => V,
    thunk?: (key: K, target: Map<K, V>) => V
  ): this;
}

interface MapConstructor {
  groupBy<K, V>(
    iterable: Iterable<V>,
    callbackfn?: (value: V) => K
  ): Map<K, Array<V>>;
  keyBy<K, V>(iterable: Iterable<V>, callbackfn?: (value: V) => K): Map<K, V>;
}

interface WeakSet<T extends object> {
  addAll(...args: Array<T>): this;
  deleteAll(...args: Array<T>): boolean;
}

interface WeakMap<K extends object, V> {
  deleteAll(...args: Array<K>): boolean;
}

入口点

core-js/proposals/collection-methods
core-js/proposals/collection-of-from
core-js(-pure)/full/set/add-all
core-js(-pure)/full/set/delete-all
core-js(-pure)/full/set/every
core-js(-pure)/full/set/filter
core-js(-pure)/full/set/find
core-js(-pure)/full/set/from
core-js(-pure)/full/set/join
core-js(-pure)/full/set/map
core-js(-pure)/full/set/of
core-js(-pure)/full/set/reduce
core-js(-pure)/full/set/some
core-js(-pure)/full/map/delete-all
core-js(-pure)/full/map/every
core-js(-pure)/full/map/filter
core-js(-pure)/full/map/find
core-js(-pure)/full/map/find-key
core-js(-pure)/full/map/from
core-js(-pure)/full/map/group-by
core-js(-pure)/full/map/includes
core-js(-pure)/full/map/key-by
core-js(-pure)/full/map/key-of
core-js(-pure)/full/map/map-keys
core-js(-pure)/full/map/map-values
core-js(-pure)/full/map/merge
core-js(-pure)/full/map/of
core-js(-pure)/full/map/reduce
core-js(-pure)/full/map/some
core-js(-pure)/full/map/update
core-js(-pure)/full/weak-set/add-all
core-js(-pure)/full/weak-set/delete-all
core-js(-pure)/full/weak-set/of
core-js(-pure)/full/weak-set/from
core-js(-pure)/full/weak-map/delete-all
core-js(-pure)/full/weak-map/of
core-js(-pure)/full/weak-map/from