Skip to content

wavejs/okei

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

okei Build Status

Object Iteration tool

Usage

const okeiMap = require('okei')('map');

const obj = {
  foo: 'poo',
  bar: 'par',
};

okeiMap(obj, val => val); // returns ['foo', 'bar']
okeiMap(obj, val => obj[val]); // returns ['poo', 'par']
okeiMap('foo', val => val); // returns ['f', 'o', 'o']

const okeiReduce = require('okei')('reduce');

okeiReduce([0, 1, 2, 3], (a, b) => a + b); // returns 6
okeiReduce([[0, 1], [2, 3], [4, 5]], (a, b) => a.concat(b), []); // returns [ 0, 1, 2, 3, 4, 5 ]
okeiReduce(obj, (newObj, key) => {
  newObj[obj[key]] = key;
  return newObj;
}, {}); // returns { poo: 'foo', par: 'bar' }

Releases

No releases published

Packages

No packages published