[Pkg-javascript-commits] [node-get-value] 01/05: Import Upstream version 2.0.6
Sruthi Chandran
srud-guest at moszumanska.debian.org
Mon Oct 17 16:47:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
srud-guest pushed a commit to branch master
in repository node-get-value.
commit bee7014784d2807adce519ff711a5c7c5c269855
Author: Sruthi <srud at disroot.org>
Date: Mon Oct 17 21:23:58 2016 +0530
Import Upstream version 2.0.6
---
LICENSE | 21 ++++++++++++++++
index.js | 50 ++++++++++++++++++++++++++++++++++++++
package.json | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 150 insertions(+)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..39245ac
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+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/index.js b/index.js
new file mode 100644
index 0000000..5879a88
--- /dev/null
+++ b/index.js
@@ -0,0 +1,50 @@
+/*!
+ * get-value <https://github.com/jonschlinkert/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;
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..df168cd
--- /dev/null
+++ b/package.json
@@ -0,0 +1,79 @@
+{
+ "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
+ }
+ }
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-get-value.git
More information about the Pkg-javascript-commits
mailing list