1.3.0 • Published 8 years ago

natex v1.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Adds useful functions to native collections by polluting their prototypes. Each function is prefixed with an underscore to prevent possible future name collision and follows signature styles similar to native functions such as Array.filter() & Array.map().

Includes TypeScript definitions and sourcemaps.

lodash functions are used where applicable.

Array<T>

_flatten(): T

Flatten the array 1 level.

lodash.flatten()

_intersect(...others: T): Array<T>

Returns a new array containing values found in all arrays.

lodash.intersection()

_minus(...others: T): Array<T>

Returns a new array with items found in the other maps removed.

lodash.difference()

_toMap<K>(key: (value: T) => K): Map<K, T>;

Transforms this array into a map.

_toMap<K, V>(key: (value: T) => K, value: (value: T) => V): Map<K, V>;

Transforms this array into a map.

_unique(): Array<T>

Returns a new array with only the first occurence of each unique value being kept.

lodash.uniq()

Map<K, V>

Functions handling more than one map will only consider the key for equality checks, and only first occurrences of a common (= equal key) item will be kept.

_copy(): Map<K, V>

Returns a shallow copy of the map.

_filter(predicate: (value: V, index: K, map: Map<K, V>) => boolean): Map<K, V>

Returns a new map containing the items filtered by the predicate.

_intersect(...others: Map<K, V>[]): Map<K, V>

Returns a new map containing items found in all maps.

_map<M>(handler: (value: V, index: K, map: Map<K, V>) => M): Map<K, M>

Returns a new map where each value is mapped against the handler.

_merge(...others: Map<K, V>[]): Map<K, V>

Returns a new map containing the values of all maps.

_minus(...others: Map<K, V>[]): Map<K, V>

Returns a new map with items found in the other maps removed.

_toArray(): V[]

Returns the values of the map as an array.

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago