The JavaScript Database, for Node.js, nw.js, electron and the browser
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
nedb/docs/utils.md

2.1 KiB

utils

Utility functions for all environments. This replaces the underscore dependency.

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 *