This package has been deprecated

Author message:

fn-object is no longer maintained. Use object-loops

fn-object

0.2.4 • Public • Published

DEPRECATED - use tjmehta/object-loops

fn-object

Build Status dependency status dev dependency status

map and filter for object keys and values

Map an Object's values

var fno = require('fn-object');
var obj = {
  key: 'val'
};
 
fno(obj).vals
  .map(function (val) {
    return val+'1';
  })
  .val()
/*
  {
    key: 'val1'
  }
*/

Filter an Object's values

var fno = require('fn-object');
var obj = {
  foo: true,
  bar: true,
  qux: false
};
 
fno(obj).vals
  .filter(function (val) {
    return val;
  })
  .val()
/*
  {
    foo: true,
    bar: true
  }
*/

Map an Object's keys

var fno = require('fn-object');
var obj = {
  key: 'val'
};
 
fno(obj).keys
  .map(function (key) {
    return key+'1';
  })
  .val()
/*
  {
    key1: 'val'
  }
*/

Filter an Object's keys

var fno = require('fn-object');
var obj = {
  key : true,
  key2: true,
  foo : true
};
 
fno(obj).keys
  .filter(function (key) {
    return key.indexOf('key') === 0;
  })
  .val()
/*
  {
    key : true,
    key2: true
  }
*/

Package Sidebar

Install

npm i fn-object

Weekly Downloads

5

Version

0.2.4

License

MIT

Last publish

Collaborators

  • tjmehta