0.0.5 • Published 5 years ago

vuke v0.0.5

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Vuke

Basically a simplified map with extra utility methods.

Install

Node 8.0.0 or higher is required.

$ npm install vuke --save

Example Usage

const Vuke = require('vuke');
const myList = new Vuke();

myList.set('john.doe@example.com', 'really-good-password-123');

console.log(`Password: ${myList.get('john.doe@example.com')}`)

API

.set(key, val)

Creates a key with a value in a specific collection.


.delete(key)

Removes a key and value from a specific collection.


.array()

Creates an ordered array of the values of a specific collection, and caches it internally.

Returns: Array


.keyArray()

Creates an ordered array of the keys of a specific collection, and caches it internally.

Returns: Array


.first(count)

Obtains the first value(s) in this collection.

ParameterTypeOptionalDefault
countNumberTruenone

Returns: Array


.firstKey(count)

Obtains the first key(s) in this collection.

ParameterTypeOptionalDefault
countNumberTruenone

Returns: Array


.last(count)

Obtains the last value(s) in this collection.

ParameterTypeOptionalDefault
countNumberTruenone

Returns: Array


.lastKey(count)

Obtains the last key(s) in this collection.

ParameterTypeOptionalDefault
countNumberTruenone

Returns: Array


.random(count)

Obtains random value(s) from this collection.

ParameterTypeOptionalDefault
countNumberTruenone

Returns: Array


.randomKey(count)

Obtains random key(s) from this collection.

ParameterTypeOptionalDefault
countNumberTruenone

Returns: Array

.filter(fn, thisArg)

Identical to Array.filter(), but returns a Collection instead of an Array.

ParameterTypeOptionalDefault
fnFunction
thisArgObjectTruenone

Returns: Vuke


.map(fn, thisArg)

Identical to Array.map().

ParameterTypeOptionalDefault
fnFunction
thisArg*Truenone

Returns: Array


.some(fn, thisArg)

Identical to Array.some().

ParameterTypeOptionalDefault
fnFunction
thisArgObjectTruenone

Returns: Boolean


.every(fn, thisArg)

Identical to Array.every().

ParameterTypeOptionalDefault
fnFunction
thisArgObjectTruenone

Returns: Boolean


.reduce(fn, initialValue)

Identical to Array.reduce().

ParameterTypeOptionalDefault
fnFunction
initialValue*Truenone

Returns: *


.clone()

Creates an identical shallow copy of this collection.

Examples:

const myNewList = myList.clone();

Returns: Vuke


.concat(...collections)

Creates an identical shallow copy of this collection.

ParameterType
collections...Collection

Examples:

const myNewList = someColl.concat(myList1, myList2, myList3);

Returns: Vuke


.deleteAll()

Calls the delete() method on all items that have it.

Returns: Array


.equals(collection)

Checks if this collection shares identical key-value pairings with another.

ParameterType
collectionsCollection

Returns: Boolean


.sort(compareFunction)

Sorts the elements of a collection in place and returns the collection.

ParameterTypeOptionalDefault
compareFunctionFunctionTruenone

Returns: Vuke


License

MIT © Aiden Bai