Socket
Socket
Sign inDemoInstall

object-iterators

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    object-iterators

Mini Underscore - object iterators


Version published
Weekly downloads
156
increased by129.41%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

object-iterators

The object iterators, similar in function to those found in underscore.js.

NOTE: As of v1.2.0, object-iterators is now a simple node module. It is no longer a "modified node module" (containing its own closure for use directly in a browser).

Synopsis

Node.js:

var Base = require('object-iterators').Base;

Browser:

<script src="http://joneit.github.io/object-iterators/object-iterators.min.js"></script>

Usage example:

var obj = {
    id: 30,
    name: 'Jack',
    gender: 'male'
};

print(obj === _(obj).each(function(value, key) { print(key, value); }));
// id 30
// name Jack
// gender male
// true

print(_(obj).reduce(function(memo, value, key) { return memo + (parseInt(value) || 0); }, 100))
// 130

print(_(obj).find(function(value, key) { return value === 'Jack'; }));
// Jack
print(_(obj).find(function(value, key) { return value === 'Jill'; }));
// undefined

function print() { console.log('// ' + Array.prototype.slice.call(arguments).join(' ')); }

API documentation

Detailed API docs can be found here.

Demo

A demo can be found here.

Or see the Underscore docs:

Just keep in mind that these are for objects only (not arrays).

CDN versions

To use in a browser, you have two options:

  1. Incorporate the node module into your own browserified project.
  2. Use the browserified versions object-iterators.js or object-iterators.min.js available on the Github pages CDN.

Submodules

See the note Regarding submodules for important information on cloning this repo or re-purposing its build template.

FAQs

Last updated on 06 Dec 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc