diff options
Diffstat (limited to 'node_modules/has-value')
-rw-r--r-- | node_modules/has-value/LICENSE | 2 | ||||
-rw-r--r-- | node_modules/has-value/README.md | 117 | ||||
-rw-r--r-- | node_modules/has-value/index.js | 9 | ||||
-rw-r--r-- | node_modules/has-value/node_modules/isobject/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/has-value/node_modules/isobject/README.md | 112 | ||||
-rw-r--r-- | node_modules/has-value/node_modules/isobject/index.js | 14 | ||||
-rw-r--r-- | node_modules/has-value/node_modules/isobject/package.json | 67 | ||||
-rw-r--r-- | node_modules/has-value/package.json | 26 |
8 files changed, 86 insertions, 282 deletions
diff --git a/node_modules/has-value/LICENSE b/node_modules/has-value/LICENSE index 39245ac1c..d734237bd 100644 --- a/node_modules/has-value/LICENSE +++ b/node_modules/has-value/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2016, Jon Schlinkert. +Copyright (c) 2014-2017, Jon Schlinkert Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/node_modules/has-value/README.md b/node_modules/has-value/README.md index a927633e5..f9b428c9a 100644 --- a/node_modules/has-value/README.md +++ b/node_modules/has-value/README.md @@ -1,4 +1,4 @@ -# has-value [](https://www.npmjs.com/package/has-value) [](https://npmjs.org/package/has-value) [](https://travis-ci.org/jonschlinkert/has-value) +# has-value [](https://www.npmjs.com/package/has-value) [](https://npmjs.org/package/has-value) [](https://npmjs.org/package/has-value) [](https://travis-ci.org/jonschlinkert/has-value) > Returns true if a value exists, false if empty. Works with deeply nested values using object paths. @@ -7,14 +7,14 @@ Install with [npm](https://www.npmjs.com/): ```sh -$ npm install has-value --save +$ npm install --save has-value ``` **Works for:** * booleans * functions -* numbers (pass `true` as the last arg to treat zero as a value instead of falsey) +* numbers * strings * nulls * object @@ -22,49 +22,57 @@ $ npm install has-value --save ## Usage -Works with nested object paths or a single value: +Works with property values (supports object-path notation, like `foo.bar`) or a single value: ```js var hasValue = require('has-value'); -hasValue({a: {b: {c: 'foo'}}} 'a.b.c'); -//=> true - -hasValue('a'); +hasValue('foo'); +hasValue({foo: 'bar'}, 'foo'); +hasValue({a: {b: {c: 'foo'}}}, 'a.b.c'); //=> true hasValue(''); +hasValue({foo: ''}, 'foo'); //=> false -hasValue(1); -//=> true - hasValue(0); -//=> false - -hasValue(0, true); // pass `true` as the last arg to treat zero as a value -//=> true - -hasValue({a: 'a'}}); +hasValue(1); +hasValue({foo: 0}, 'foo'); +hasValue({foo: 1}, 'foo'); +hasValue({foo: null}, 'foo'); +hasValue({foo: {bar: 'a'}}}, 'foo'); +hasValue({foo: {bar: 'a'}}}, 'foo.bar'); //=> true -hasValue({}}); +hasValue({foo: {}}}, 'foo'); +hasValue({foo: {bar: {}}}}, 'foo.bar'); +hasValue({foo: undefined}, 'foo'); //=> false -hasValue(['a']); -//=> true - hasValue([]); +hasValue([[]]); +hasValue([[], []]); +hasValue([undefined]); +hasValue({foo: []}, 'foo'); //=> false -hasValue(function(foo) {}); // function length/arity +hasValue([0]); +hasValue([null]); +hasValue(['foo']); +hasValue({foo: ['a']}, 'foo'); //=> true -hasValue(function() {}); -//=> false +hasValue(function() {}) +hasValue(function(foo) {}) +hasValue({foo: function(foo) {}}, 'foo'); +hasValue({foo: function() {}}, 'foo'); +//=> true hasValue(true); hasValue(false); +hasValue({foo: true}, 'foo'); +hasValue({foo: false}, 'foo'); //=> true ``` @@ -73,58 +81,69 @@ hasValue(false); To do the opposite and test for empty values, do: ```js -function isEmpty(o, isZero) { +function isEmpty(o) { return !hasValue.apply(hasValue, arguments); } ``` -## Related projects +## Release history -You might also be interested in these projects: +### v1.0.0 -* [get-object](https://www.npmjs.com/package/get-object): Get a property from an object using dot (object path) notation. | [homepage](https://github.com/jonschlinkert/get-object) -* [get-property](https://www.npmjs.com/package/get-property): Get a nested property or its value from an object using simple `a.b.c` paths. | [homepage](https://github.com/jonschlinkert/get-property) -* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value) -* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value) +* `zero` always returns true +* `array` now recurses, so that an array of empty arrays will return `false` +* `null` now returns true -## Contributing +## About -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/has-value/issues/new). +### Related projects -## Building docs +* [define-property](https://www.npmjs.com/package/define-property): Define a non-enumerable property on an object. | [homepage](https://github.com/jonschlinkert/define-property "Define a non-enumerable property on an object.") +* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value "Use property paths (`a.b.c`) to get a nested value from an object.") +* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.") +* [unset-value](https://www.npmjs.com/package/unset-value): Delete nested properties from an object using dot notation. | [homepage](https://github.com/jonschlinkert/unset-value "Delete nested properties from an object using dot notation.") -Generate readme and API documentation with [verb](https://github.com/verbose/verb): +### Contributing -```sh -$ npm install verb && npm run docs -``` +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 17 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [rmharrison](https://github.com/rmharrison) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ -Or, if [verb](https://github.com/verbose/verb) is installed globally: +To generate the readme, run the following command: ```sh -$ verb +$ npm install -g verbose/verb#dev verb-generate-readme && verb ``` -## Running tests +### Running tests -Install dev dependencies: +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: ```sh -$ npm install -d && npm test +$ npm install && npm test ``` -## Author +### Author **Jon Schlinkert** * [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) -## License +### License -Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT license](https://github.com/jonschlinkert/has-value/blob/master/LICENSE). +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). *** -_This file was generated by [verb](https://github.com/verbose/verb), v, on March 27, 2016._
\ No newline at end of file +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 19, 2017._
\ No newline at end of file diff --git a/node_modules/has-value/index.js b/node_modules/has-value/index.js index 90687c877..c23749488 100644 --- a/node_modules/has-value/index.js +++ b/node_modules/has-value/index.js @@ -1,7 +1,7 @@ /*! * has-value <https://github.com/jonschlinkert/has-value> * - * Copyright (c) 2014-2016, Jon Schlinkert. + * Copyright (c) 2014-2017, Jon Schlinkert. * Licensed under the MIT License. */ @@ -11,9 +11,6 @@ var isObject = require('isobject'); var hasValues = require('has-values'); var get = require('get-value'); -module.exports = function(obj, prop, noZero) { - if (isObject(obj)) { - return hasValues(get(obj, prop), noZero); - } - return hasValues(obj, prop); +module.exports = function(val, prop) { + return hasValues(isObject(val) && prop ? get(val, prop) : val); }; diff --git a/node_modules/has-value/node_modules/isobject/LICENSE b/node_modules/has-value/node_modules/isobject/LICENSE deleted file mode 100644 index 39245ac1c..000000000 --- a/node_modules/has-value/node_modules/isobject/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2016, Jon Schlinkert. - -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. diff --git a/node_modules/has-value/node_modules/isobject/README.md b/node_modules/has-value/node_modules/isobject/README.md deleted file mode 100644 index 9dd897aa0..000000000 --- a/node_modules/has-value/node_modules/isobject/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# isobject [](https://www.npmjs.com/package/isobject) [](https://npmjs.org/package/isobject) [](https://travis-ci.org/jonschlinkert/isobject) - -Returns true if the value is an object and not an array or null. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install isobject --save -``` - -Use [is-plain-object](https://github.com/jonschlinkert/is-plain-object) if you want only objects that are created by the `Object` constructor. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install isobject -``` - -Install with [bower](http://bower.io/) - -```sh -$ bower install isobject -``` - -## Usage - -```js -var isObject = require('isobject'); -``` - -**True** - -All of the following return `true`: - -```js -isObject({}); -isObject(Object.create({})); -isObject(Object.create(Object.prototype)); -isObject(Object.create(null)); -isObject({}); -isObject(new Foo); -isObject(/foo/); -``` - -**False** - -All of the following return `false`: - -```js -isObject(); -isObject(function () {}); -isObject(1); -isObject([]); -isObject(undefined); -isObject(null); -``` - -## Related projects - -You might also be interested in these projects: - -[merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep) - -* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow) -* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object) -* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of) - -## Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/isobject/issues/new). - -## Building docs - -Generate readme and API documentation with [verb](https://github.com/verbose/verb): - -```sh -$ npm install verb && npm run docs -``` - -Or, if [verb](https://github.com/verbose/verb) is installed globally: - -```sh -$ verb -``` - -## Running tests - -Install dev dependencies: - -```sh -$ npm install -d && npm test -``` - -## Author - -**Jon Schlinkert** - -* [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) - -## License - -Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT license](https://github.com/jonschlinkert/isobject/blob/master/LICENSE). - -*** - -_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 25, 2016._
\ No newline at end of file diff --git a/node_modules/has-value/node_modules/isobject/index.js b/node_modules/has-value/node_modules/isobject/index.js deleted file mode 100644 index aa0dce0bb..000000000 --- a/node_modules/has-value/node_modules/isobject/index.js +++ /dev/null @@ -1,14 +0,0 @@ -/*! - * isobject <https://github.com/jonschlinkert/isobject> - * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License. - */ - -'use strict'; - -var isArray = require('isarray'); - -module.exports = function isObject(val) { - return val != null && typeof val === 'object' && isArray(val) === false; -}; diff --git a/node_modules/has-value/node_modules/isobject/package.json b/node_modules/has-value/node_modules/isobject/package.json deleted file mode 100644 index 954f4113f..000000000 --- a/node_modules/has-value/node_modules/isobject/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "isobject", - "description": "Returns true if the value is an object and not an array or null.", - "version": "2.1.0", - "homepage": "https://github.com/jonschlinkert/isobject", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/isobject", - "bugs": { - "url": "https://github.com/jonschlinkert/isobject/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "isarray": "1.0.0" - }, - "devDependencies": { - "gulp-format-md": "^0.1.9", - "mocha": "^2.4.5" - }, - "keywords": [ - "check", - "is", - "is-object", - "isobject", - "kind", - "kind-of", - "kindof", - "native", - "object", - "type", - "typeof", - "value" - ], - "verb": { - "related": { - "list": [ - "merge-deep", - "extend-shallow", - "is-plain-object", - "kind-of" - ] - }, - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "reflinks": [ - "verb" - ] - } -} diff --git a/node_modules/has-value/package.json b/node_modules/has-value/package.json index 88ff6edc8..e65d4380d 100644 --- a/node_modules/has-value/package.json +++ b/node_modules/has-value/package.json @@ -1,9 +1,13 @@ { "name": "has-value", - "version": "0.3.1", "description": "Returns true if a value exists, false if empty. Works with deeply nested values using object paths.", + "version": "1.0.0", "homepage": "https://github.com/jonschlinkert/has-value", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Ryan M Harrison (https://linkedin.com/in/harrisonrm)" + ], "repository": "jonschlinkert/has-value", "bugs": { "url": "https://github.com/jonschlinkert/has-value/issues" @@ -20,13 +24,13 @@ "test": "mocha" }, "dependencies": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" }, "devDependencies": { - "gulp-format-md": "^0.1.7", - "mocha": "^2.4.5" + "gulp-format-md": "^0.1.12", + "mocha": "^3.4.1" }, "keywords": [ "array", @@ -65,15 +69,13 @@ ], "related": { "list": [ - "get-object", - "get-property", + "define-property", "get-value", - "set-value" + "set-value", + "unset-value" ] }, - "reflinks": [ - "verb" - ], + "reflinks": [], "lint": { "reflinks": true } |