npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

underscore.object.plus

v1.0.0

Published

Some extra object functions for underscore.js. Such as deep extend, nested pick and nested omit.

Downloads

5

Readme

#underscore.object.plus

Some extra object functions for underscore.js. Such as deep extend, nested pick and nested omit.

Please note that extend, isWindow and isPlainObject functions are ported from jQuery 2.1.0 (Source)

##Table of Contents

Underscore.js 1.6.0

pick function with nested functionality added.

Invoked if type of keys is strictly object (not array or function).

pick _.pick(object, keys...) Delegates to Underscore.js 1.6.0 (API Doc)

Original pick function preserved from Underscore.js

omit function with nested functionality added.

Invoked if type of keys is strictly object (not array or function).

omit _.omit(object, keys...) Delegates to Underscore.js 1.6.0 (API Doc)

Original omit function preserved from Underscore.js

Returns true if object is strictly object (not array or function)

Invoked if strict is true

isObject _.isObject(object) Delegates to Underscore.js 1.6.0 (API Doc)

Original isObject function preserved from Underscore.js

Returns true if object is of one of the types specified by types

types can be a string, strings, array of strings or mixed

isWindow _.isWindow(object) Ported from jQuery 2.1.0 (API Doc)

isWindow function ported from jQuery 2.1.0

Ported to facilitate the porting of extend function from jQuery 2.1.0

isPlainObject _.isPlainObject(object) Ported from jQuery 2.1.0 (API Doc)

isPlainObject function ported from jQuery 2.1.0

Ported to facilitate the porting of extend function from jQuery 2.1.0

Returns a sorted list of the names of every objects (including array and function) in object, or strictly objects (not array or function) if strict is true

In another words, returns the name of every object property of object

Returns a sorted list of the names of every arrays in object

In another words, returns the name of every array property of object

Returns a sorted list of the names of every property in object that is of one of the types specified by types

In another words, returns the name of every property of object satisfying isTypes(object, types)

var stock = {
  popsicle: {
    chocolate:  15,
    fruits: {
      orange:   13,
      mango:    27
    }
  },
  "ice cream": {
    chocolate:  16,
    vanilla:    27,
    fruits: {
      orange:   21,
      mango:    16
    }
  }
};
var keys = {
  popsicle: {
    chocolate:  1,
    fruits: {
      mango:    1
    }
  },
  "ice cream": {
    fruits: ['orange', 'mango']
  }
};

_.pick(stock, keys);

{ popsicle: { chocolate: 15, fruits: { mango: 27 } }, "ice cream": { fruits: { orange: 21, mango: 16 } } };


_([Back to list of functions](#list-pick))_

<a name="examples-isObject" />
***isObject*** \_.isObject(object, strict)
_([Back to list of functions](#list-isObject))_

``` javascript
_.isObject({}, true);
// => true

_.isObject([], true);
// => false

_.isObject(function() {}, true);
// => false

(Back to list of functions)

var stock = {
  popsicle: {
    chocolate:  15,
    fruits: {
      orange:   13,
      mango:    27
    }
  },
  "ice cream": {
    chocolate:  16,
    vanilla:    27,
    fruits: {
      orange:   21,
      mango:    16
    }
  }
};
var keys = {
  popsicle: {
    fruits: {
      orange:   1
    }
  },
  "ice cream": {
    fruits: ['orange', 'mango']
  }
};

_.omit(stock, keys);

{ popsicle: { chocolate: 15, fruits: { mango: 27 } }, "ice cream": { chocolate: 16, vanilla: 27 } };


_([Back to list of functions](#list-omit))_

<a name="tests" />
## Tests
Version | URL
------- | ---
master  | https://rawgithub.com/lamgavin/underscore.object.plus/master/test/index.html
1.0.0   | https://rawgithub.com/lamgavin/underscore.object.plus/master/test/release/1_0_0/index.html

<a name="license" />
## License
The MIT License (MIT)

Copyright (c) 2014 Gavin Lam and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

<a name="changes" />
##Change Log
***1.0.0***
- First release
- Test report: https://rawgithub.com/lamgavin/underscore.object.plus/master/test/release/1_0_0/index.html