# underscore.object.plus

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

Latest version **1.0.0** (published 2014-04-01) · 0 weekly downloads

## Install

```sh
npm install underscore.object.plus
pnpm add underscore.object.plus
yarn add underscore.object.plus
bun add underscore.object.plus
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-04-01 |
| First published | 2014-04-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | Gavin Lam |
| Maintainers | lamgavin |
| Keywords | util, functional, server, client, browser, underscore, deep, nested |

## Links

- npm: https://www.npmjs.com/package/underscore.object.plus
- Repository: https://github.com/lamgavin/underscore.object.plus
- Issues: https://github.com/lamgavin/underscore.object.plus/issues
- npm.io page: https://npm.io/package/underscore.object.plus

## Dependencies (1)

- [underscore](https://npm.io/package/underscore.md) ~1.6.0

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2014-04-01

## 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](http://code.jquery.com/jquery-2.1.0.js))

##Table of Contents
- [Requirements](#requirements)
- [Installation](#installation)
- [Downloads](#downloads)
- [Usage](#usage)
- [List of Functions](#list)
- [Examples](#examples)
- [Tests](#tests)
- [License](#license)
- [Change Log](#changes)

<a name="requirements" />
##Requirements

Underscore.js 1.6.0

<a name="installation" />
##Installation
``` bash
$ npm install underscore.object.plus
```

<a name="downloads" />
##Downloads
Version | Description
------- | -----------
[Production (1.0.0)](https://rawgithub.com/lamgavin/underscore.object.plus/master/release/1_0_0/underscore.object.plus.min.js) | _1.14KB, Minified and Gzipped ([Source Map](https://rawgithub.com/lamgavin/underscore.object.plus/master/release/1_0_0/underscore.object.plus.min.map))_
[Development (1.0.0)](https://rawgithub.com/lamgavin/underscore.object.plus/master/release/1_0_0/underscore.object.plus.js) | _6.2KB, Uncompressed ([Source Map](https://rawgithub.com/lamgavin/underscore.object.plus/master/release/1_0_0/underscore.object.plus.map))_
[CoffeeScript (1.0.0)](https://rawgithub.com/lamgavin/underscore.object.plus/master/release/1_0_0/underscore.object.plus.coffee) | _5.9KB (Uncompress and with comments)_

<a name="usage" />
##Usage
``` html
<!-- Underscore.js 1.6.0 -->
<script src="http://underscorejs.org/underscore-min.js"></script>
<script src="underscore.object.plus.min.js"></script>
```
Node.js through require.js
``` javascript
_           = require('underscore');
_           = require('underscore.object.plus');
```

<a name="list" />
## List of Functions
***extend*** \_.extend([deep], target, sources...)
_Ported from jQuery 2.1.0 ([API Doc](http://api.jquery.com/jQuery.extend/))_
> ***_extend_*** function ported from jQuery 2.1.0
> 
> Deep clone using ***_.extend({}, sources...);***

<a name="list-pick" />
***pick*** \_.pick(object, keys) _Aliases: ***pickNested, pickRecursive***_
_([Example](#examples-pick))_

> ***_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](http://underscorejs.org/#pick))_

> Original ***_pick_*** function preserved from Underscore.js

<a name="list-omit" />
***omit*** \_.omit(object, keys) _Aliases: ***omitNested, omitRecursive***_
_([Example](#examples-omit))_

> ***_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](http://underscorejs.org/#omit))_

> Original ***_omit_*** function preserved from Underscore.js

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

> 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](http://underscorejs.org/#isObject))_

> Original ***_isObject_*** function preserved from Underscore.js

<a name="list-isTypes" />
***isTypes*** \_.isTypes(object, types...)
_([Example](#examples-isTypes))_

> 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](http://api.jquery.com/jQuery.isWindow/))_
> ***_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](http://api.jquery.com/jQuery.isPlainObject/))_
> ***_isPlainObject_*** function ported from jQuery 2.1.0
> 
> Ported to facilitate the porting of ***_extend_*** function from jQuery 2.1.0

<a name="list-objects" />
***objects*** \_.objects(object, [strict])
_([Example](#examples-objects))_

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

<a name="list-arrays" />
***arrays*** \_.arrays(object)
_([Example](#examples-arrays))_

> Returns a sorted list of the names of every arrays in ***object***
> 
> In another words, returns the name of every array property of ***object***

<a name="list-types" />
***types*** \_.types(object, types...)
_([Example](#examples-types))_

> 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)_***

<a name="examples" />
## Examples

<a name="examples-pick" />
***pick*** \_.pick(object, keys) _Aliases: ***pickNested, pickRecursive***_
_([Back to list of functions](#list-pick))_

``` javascript
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);
```
> ``` javascript
{
  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](#list-isObject))_

<a name="examples-omit" />
***omit*** \_.omit(object, keys) _Aliases: ***omitNested, omitRecursive***_
_([Back to list of functions](#list-omit))_

``` javascript
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);
```
> ``` javascript
{
  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

---
_Source: https://npm.io/package/underscore.object.plus · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
