JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q29213F
  • License MIT

Better version of a map with more utility methods.

Package Exports

  • vuke

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vuke) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.

Parameter Type Optional Default
count Number True none

Returns: Array


.firstKey(count)

Obtains the first key(s) in this collection.

Parameter Type Optional Default
count Number True none

Returns: Array


.last(count)

Obtains the last value(s) in this collection.

Parameter Type Optional Default
count Number True none

Returns: Array


.lastKey(count)

Obtains the last key(s) in this collection.

Parameter Type Optional Default
count Number True none

Returns: Array


.random(count)

Obtains random value(s) from this collection.

Parameter Type Optional Default
count Number True none

Returns: Array


.randomKey(count)

Obtains random key(s) from this collection.

Parameter Type Optional Default
count Number True none

Returns: Array

.filter(fn, thisArg)

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

Parameter Type Optional Default
fn Function
thisArg Object True none

Returns: Vuke


.map(fn, thisArg)

Identical to Array.map().

Parameter Type Optional Default
fn Function
thisArg * True none

Returns: Array


.some(fn, thisArg)

Identical to Array.some().

Parameter Type Optional Default
fn Function
thisArg Object True none

Returns: Boolean


.every(fn, thisArg)

Identical to Array.every().

Parameter Type Optional Default
fn Function
thisArg Object True none

Returns: Boolean


.reduce(fn, initialValue)

Identical to Array.reduce().

Parameter Type Optional Default
fn Function
initialValue * True none

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.

Parameter Type
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.

Parameter Type
collections Collection

Returns: Boolean


.sort(compareFunction)

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

Parameter Type Optional Default
compareFunction Function True none

Returns: Vuke


License

MIT © Aiden Bai