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

otools

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

otools

simple mixin and a few functions for working with js objects

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

otools

Simple mixin and a few other functions for working with js objects

mixin(target, ...sources) - Simple mixin that takes multiple sources.

Mixin does NOT copy non-enumerable properties. It returns target object.

var mixin = require('otools').mixin;

var opts = mixin({}, defaults, opts);

each(object, function) - Loops over object keys and values with an iterator function.

Each does NOT iterate over non-enumerable properties.

var each = require('otools').each;

var obj = { Hello: " World!", "Goodbye": " everybody!" };
each(obj, function(value, key) {
  // this === obj
  console.log(key, value);
});

// Hello World!
// Goodbye everbody!

eachOwn(object, function) - Only loops over own properties of the object

eachOwn does NOT iterate over inherited properties or non-enumerable properties.

var eachOwn = require('otools').eachOwn;

var obj2 = Object.create(obj);
obj2.nothing = " to say."
// inherited from prototype
// obj2.Hello === ' World!'

eachOwn(obj2, function(value, key) {
  console.log(key, value);
});

// Nothing to say!

Keywords

FAQs

Package last updated on 30 Mar 2013

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