2.1 KiB
utils
Utility functions for all environments. This replaces the underscore dependency.
- utils
- static
- .uniq(array, [iteratee]) ⇒
Array
- .isDate(d) ⇒
boolean
- .isRegExp(re) ⇒
boolean
- .uniq(array, [iteratee]) ⇒
- inner
- ~isObject(arg) ⇒
boolean
- ~isObject(arg) ⇒
- static
utils.uniq(array, [iteratee]) ⇒ Array
Produces a duplicate-free version of the array, using === to test object equality. In particular only the first occurrence of each value is kept. If you want to compute unique items based on a transformation, pass an iteratee function. Heavily inspired by https://underscorejs.org/#uniq
Kind: static method of utils
Param | Type | Description |
---|---|---|
array | Array |
|
[iteratee] | function |
transformation applied to every element before checking for duplicates. This will not transform the items in the result. |
utils.isDate(d) ⇒ boolean
Returns true if d is a Date. Heavily inspired by https://underscorejs.org/#isDate
Kind: static method of utils
Param | Type |
---|---|
d | * |
utils.isRegExp(re) ⇒ boolean
Returns true if re is a RegExp. Heavily inspired by https://underscorejs.org/#isRegExp
Kind: static method of utils
Param | Type |
---|---|
re | * |
utils~isObject(arg) ⇒ boolean
Returns true if arg is an Object. Note that JavaScript arrays and functions are objects, while (normal) strings and numbers are not. Heavily inspired by https://underscorejs.org/#isObject
Kind: inner method of utils
Param | Type |
---|---|
arg | * |