{"name":"object-tools","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"1.2.2","description":"Useful functions for working with objects","repository":{"type":"git","url":"https://github.com/75lb/object-tools.git"},"main":"./lib/object-tools.js","keywords":[],"scripts":{"test":"tape test/*.js","lint":"jshint lib/*.js test/*.js; echo","docs":"jsdoc2md -t jsdoc2md/README.hbs -l js lib/*.js > README.md; echo"},"devDependencies":{"tape":"^3"},"dependencies":{"array-tools":"^1.1.4","typical":"^1.0.0"},"gitHead":"aea5f495b6e3c363a891b54c3886304656b2997b","bugs":{"url":"https://github.com/75lb/object-tools/issues"},"homepage":"https://github.com/75lb/object-tools","_id":"object-tools@1.2.2","_shasum":"b8c090fca1c09bf52f19fbf0bb3b0f4d7d993fa6","_from":".","_npmVersion":"2.7.1","_nodeVersion":"0.12.0","_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"dist":{"shasum":"b8c090fca1c09bf52f19fbf0bb3b0f4d7d993fa6","tarball":"http://registry-npm.ywwl.com/object-tools/download/object-tools-1.2.2.tgz","integrity":"sha512-YHov2Mbs+NnoEHT+7GUiLJgoN3DiDJLWwGJawMdQXR8QnIOm4g05S4pAW/9L/Gxf58jvqGml35z6RPfUfnw3yw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJgRcYiWSV3xes41YwZCpCIDVG3vpPT/35YTlA6kwFAwIhALFsUZ9/ZCl/UfQxcW7dxARP67DI8Y7kpNGHpT34mRnk"}],"size":5958,"noattachment":false,"key":"/object-tools/-/object-tools-1.2.2.tgz"},"directories":{},"readme":"[![view on npm](http://img.shields.io/npm/v/object-tools.svg)](https://www.npmjs.org/package/object-tools)\n[![npm module downloads](http://img.shields.io/npm/dt/object-tools.svg)](https://www.npmjs.org/package/object-tools)\n[![Build Status](https://travis-ci.org/75lb/object-tools.svg?branch=master)](https://travis-ci.org/75lb/object-tools)\n[![Dependency Status](https://david-dm.org/75lb/object-tools.svg)](https://david-dm.org/75lb/object-tools)\n[![Coverage Status](https://coveralls.io/repos/75lb/object-tools/badge.svg?branch=master)](https://coveralls.io/r/75lb/object-tools?branch=master)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n<a name=\"module_object-tools\"></a>\n## object-tools\nUseful functions for working with objects\n\n**Example**  \n```js\nvar o = require('object-tools')\n```\n\n* [object-tools](#module_object-tools)\n    * [.extend(...object)](#module_object-tools.extend) ⇒ <code>object</code>\n    * [.clone(input)](#module_object-tools.clone) ⇒ <code>object</code> &#124; <code>array</code>\n    * [.every(object, iterator)](#module_object-tools.every) ⇒ <code>boolean</code>\n    * [.each(object, callback)](#module_object-tools.each)\n    * [.exists(object, query)](#module_object-tools.exists) ⇒ <code>boolean</code>\n    * [.without(object, toRemove)](#module_object-tools.without) ⇒ <code>object</code>\n    * [.where(object, query)](#module_object-tools.where) ⇒ <code>object</code>\n    * [.extract(object, query)](#module_object-tools.extract) ⇒ <code>object</code>\n    * [.select(object, fields)](#module_object-tools.select) ⇒ <code>object</code>\n    * [.get(object, expression)](#module_object-tools.get) ⇒ <code>\\*</code>\n\n<a name=\"module_object-tools.extend\"></a>\n### o.extend(...object) ⇒ <code>object</code>\nMerge a list of objects, left to right, into one - to a maximum depth of 10.\n\n**Kind**: static method of <code>[object-tools](#module_object-tools)</code>  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| ...object | <code>object</code> | a sequence of object instances to be extended |\n\n**Example**  \n```js\n> o.extend({ one: 1, three: 3 }, { one: 'one', two: 2 }, { four: 4 })\n{ one: 'one',\n  three: 3,\n  two: 2,\n  four: 4 }\n```\n<a name=\"module_object-tools.clone\"></a>\n### o.clone(input) ⇒ <code>object</code> &#124; <code>array</code>\nClones an object or array\n\n**Kind**: static method of <code>[object-tools](#module_object-tools)</code>  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | <code>object</code> &#124; <code>array</code> | the input to clone |\n\n**Example**  \n```js\n> date = new Date()\nFri May 09 2014 13:54:34 GMT+0200 (CEST)\n> o.clone(date)\n{}  // a Date instance doesn't own any properties\n> date.clive = 'hater'\n'hater'\n> o.clone(date)\n{ clive: 'hater' }\n> array = [1,2,3]\n[ 1, 2, 3 ]\n> newArray = o.clone(array)\n[ 1, 2, 3 ]\n> array === newArray\nfalse\n```\n<a name=\"module_object-tools.every\"></a>\n### o.every(object, iterator) ⇒ <code>boolean</code>\nReturns true if the supplied iterator function returns true for every property in the object\n\n**Kind**: static method of <code>[object-tools](#module_object-tools)</code>  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| object | <code>object</code> | the object to inspect |\n| iterator | <code>function</code> | the iterator function to run against each key/value pair, the args are `(value, key)`. |\n\n**Example**  \n```js\n> function aboveTen(input){ return input > 10; }\n> o.every({ eggs: 12, carrots: 30, peas: 100 }, aboveTen)\ntrue\n> o.every({ eggs: 6, carrots: 30, peas: 100 }, aboveTen)\nfalse\n```\n<a name=\"module_object-tools.each\"></a>\n### o.each(object, callback)\nRuns the iterator function against every key/value pair in the input object\n\n**Kind**: static method of <code>[object-tools](#module_object-tools)</code>  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| object | <code>object</code> | the object to iterate |\n| callback | <code>function</code> | the iterator function to run against each key/value pair, the args are `(value, key)`. |\n\n**Example**  \n```js\n> var total = 0\n> function addToTotal(n){ total += n; }\n> o.each({ eggs: 3, celery: 2, carrots: 1 }, addToTotal)\n> total\n6\n```\n<a name=\"module_object-tools.exists\"></a>\n### o.exists(object, query) ⇒ <code>boolean</code>\nreturns true if the key/value pairs in `query` also exist identically in `object`.\nAlso supports RegExp values in `query`. If the `query` property begins with `!` then test is negated.\n\n**Kind**: static method of <code>[object-tools](#module_object-tools)</code>  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| object | <code>object</code> | the object to examine |\n| query | <code>object</code> | the key/value pairs to look for |\n\n**Example**  \n```js\n> o.exists({ a: 1, b: 2}, {a: 0})\nfalse\n> o.exists({ a: 1, b: 2}, {a: 1})\ntrue\n> o.exists({ a: 1, b: 2}, {'!a': 1})\nfalse\n> o.exists({ name: 'clive hater' }, { name: /clive/ })\ntrue\n> o.exists({ name: 'clive hater' }, { '!name': /ian/ })\ntrue\n> o.exists({ a: 1}, { a: function(n){ return n > 0; } })\ntrue\n> o.exists({ a: 1}, { a: function(n){ return n > 1; } })\nfalse\n```\n<a name=\"module_object-tools.without\"></a>\n### o.without(object, toRemove) ⇒ <code>object</code>\nReturns a clone of the object minus the specified properties. See also [select](#module_object-tools.select).\n\n**Kind**: static method of <code>[object-tools](#module_object-tools)</code>  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| object | <code>object</code> | the input object |\n| toRemove | <code>string</code> &#124; <code>Array.&lt;string&gt;</code> | a single property, or array of properties to omit |\n\n**Example**  \n```js\n> o.without({ a: 1, b: 2, c: 3}, 'b')\n{ a: 1, c: 3 }\n> o.without({ a: 1, b: 2, c: 3}, ['b', 'a'])\n{ c: 3 }\n```\n<a name=\"module_object-tools.where\"></a>\n### o.where(object, query) ⇒ <code>object</code>\nReturns a new object containing the key/value pairs which satisfy the query\n\n**Kind**: static method of <code>[object-tools](#module_object-tools)</code>  \n**Since**: 1.2.0  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| object | <code>object</code> | The input object |\n| query | <code>Array.&lt;string&gt;</code> &#124; <code>function</code> | Either an array of property names, or a function. The function is called with `(value, key)` and must return `true` to be included in the output. |\n\n**Example**  \n```js\n> object = { a: 1, b: 0, c: 2 }\n{ a: 1, b: 0, c: 2 }\n> o.where(object, function(value, key){\n      return value > 0\n  })\n{ a: 1, c: 2 }\n> o.where(object, [ 'b' ])\n{ b: 0 }\n> object\n{ a: 1, b: 0, c: 2 }\n```\n<a name=\"module_object-tools.extract\"></a>\n### o.extract(object, query) ⇒ <code>object</code>\nidentical to `o.where(object, query)` with one exception - the found properties are removed from the input `object`\n\n**Kind**: static method of <code>[object-tools](#module_object-tools)</code>  \n**Since**: 1.2.0  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| object | <code>object</code> | The input object |\n| query | <code>Array.&lt;string&gt;</code> &#124; <code>function</code> | Either an array of property names, or a function. The function is called with `(value, key)` and must return `true` to be included in the output. |\n\n**Example**  \n```js\n> object = { a: 1, b: 0, c: 2 }\n{ a: 1, b: 0, c: 2 }\n> o.where(object, function(value, key){\n      return value > 0\n  })\n{ a: 1, c: 2 }\n> object\n{ b: 0 }\n```\n<a name=\"module_object-tools.select\"></a>\n### o.select(object, fields) ⇒ <code>object</code>\nReturns a new object containing only the selected fields. See also [without](#module_object-tools.without).\n\n**Kind**: static method of <code>[object-tools](#module_object-tools)</code>  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| object | <code>object</code> | the input object |\n| fields | <code>string</code> &#124; <code>array</code> | a list of fields to return |\n\n<a name=\"module_object-tools.get\"></a>\n### o.get(object, expression) ⇒ <code>\\*</code>\nReturns the value at the given property.\n\n**Kind**: static method of <code>[object-tools](#module_object-tools)</code>  \n**Since**: 1.4.0  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| object | <code>object</code> | the input object |\n| expression | <code>string</code> | the property accessor expression |\n\n\n* * *\n\n&copy; 2014-16 Lloyd Brookes \\<75pound@gmail.com\\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n","publish_time":1427296446016,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","_cnpm_publish_time":1427296446016,"dist-tags":{"latest":"2.0.6"}}