karmia-utility-array
Karmia array utility module.
Last updated 5 months ago by fujimaki-k .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install karmia-utility-array 
SYNC missed versions from official npm registry.

karmia-utility-array

Karmia utility array module

Usage

const karmia_utility_array = require('karmia-utility-array').default,
    karray = new karmia_utility_array();

unique

  • list <Array>

Removes duplicate values from an array

count

  • list <Array>
  • item <*>

Count item in list

range

  • start <number>
  • stop <number>
  • step <number> Default: 1

Get array of integer from start to end

karray.range(5);
// => [0, 1, 2, 3, 4]

karray.range(5, 10);
// => [5, 6, 7, 8, 9]

karray.range(3, 10, 3);
// => [3, 6, 9]

flip

  • list <Array>

Get object that exchanges index with their value

karray.flip(['a', 'b', 'c', 'd', 'e']);
// => {a: 0, b: 1, c: 2, d: 3, e: 4}

intersection

  • list1 <Array>
  • list2 <Array>

Get intersection of two arrays

const list1 = ['a', 'b', 'b', 'c', 'c', 'c'],
    list2 = ['a', 'b'];

console.log(karray.difference(list1, list2));
// => ['a', 'b']

difference

  • list1 <Array>
  • list2 <Array>

Get difference of two arrays

const list1 = ['a', 'b', 'b', 'c', 'c', 'c'],
    list2 = ['a', 'b'];

console.log(karray.difference(list1, list2));
// => ['c', 'c', 'c']

Current Tags

  • 0.4.1                                ...           latest (5 months ago)

11 Versions

  • 0.4.1                                ...           5 months ago
  • 0.4.0                                ...           5 months ago
  • 0.3.3                                ...           7 months ago
  • 0.3.2                                ...           7 months ago
  • 0.3.1                                ...           7 months ago
  • 0.3.0                                ...           7 months ago
  • 0.2.1                                ...           8 months ago
  • 0.2.0                                ...           8 months ago
  • 0.1.2                                ...           8 months ago
  • 0.1.1                                ...           8 months ago
  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (1)
Dev Dependencies (8)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |