Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fn-object

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fn-object

map and filter for object's keys and values, and get a modified object

  • 0.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

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
  }
*/

Keywords

FAQs

Package last updated on 03 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc