package/package.json000644 000767 000024 0000003015 12731202762013020 0ustar00000000 000000 { "name": "get-value", "description": "Use property paths (`a.b.c`) to get a nested value from an object.", "version": "2.0.6", "homepage": "https://github.com/jonschlinkert/get-value", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", "repository": "jonschlinkert/get-value", "bugs": { "url": "https://github.com/jonschlinkert/get-value/issues" }, "license": "MIT", "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "devDependencies": { "ansi-bold": "^0.1.1", "arr-reduce": "^1.0.1", "benchmarked": "^0.1.4", "dot-prop": "^2.2.0", "getobject": "^0.1.0", "gulp": "^3.9.0", "gulp-eslint": "^1.1.1", "gulp-format-md": "^0.1.5", "gulp-istanbul": "^0.10.2", "gulp-mocha": "^2.1.3", "isobject": "^2.0.0", "matched": "^0.3.2", "minimist": "^1.2.0" }, "keywords": [ "get", "key", "nested", "object", "path", "paths", "prop", "properties", "property", "props", "segment", "value", "values" ], "verb": { "run": true, "toc": false, "layout": "default", "tasks": [ "readme" ], "plugins": [ "gulp-format-md" ], "related": { "list": [ "has-any", "has-any-deep", "has-value", "set-value", "unset-value" ] }, "reflinks": [ "verb", "verb-readme-generator" ], "lint": { "reflinks": true } } } package/LICENSE000644 000767 000024 0000002100 12731202554011530 0ustar00000000 000000 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. package/index.js000644 000767 000024 0000002060 12731066203012174 0ustar00000000 000000 /*! * get-value * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT License. */ module.exports = function(obj, prop, a, b, c) { if (!isObject(obj) || !prop) { return obj; } prop = toString(prop); // allowing for multiple properties to be passed as // a string or array, but much faster (3-4x) than doing // `[].slice.call(arguments)` if (a) prop += '.' + toString(a); if (b) prop += '.' + toString(b); if (c) prop += '.' + toString(c); if (prop in obj) { return obj[prop]; } var segs = prop.split('.'); var len = segs.length; var i = -1; while (obj && (++i < len)) { var key = segs[i]; while (key[key.length - 1] === '\\') { key = key.slice(0, -1) + '.' + segs[++i]; } obj = obj[key]; } return obj; }; function isObject(val) { return val !== null && (typeof val === 'object' || typeof val === 'function'); } function toString(val) { if (!val) return ''; if (Array.isArray(val)) { return val.join('.'); } return val; }