Version 1
[yaffs-website] / node_modules / grunt-legacy-log-utils / node_modules / lodash / _isKey.js
diff --git a/node_modules/grunt-legacy-log-utils/node_modules/lodash/_isKey.js b/node_modules/grunt-legacy-log-utils/node_modules/lodash/_isKey.js
new file mode 100644 (file)
index 0000000..0e34576
--- /dev/null
@@ -0,0 +1,24 @@
+var isArray = require('./isArray');
+
+/** Used to match property names within property paths. */
+var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
+    reIsPlainProp = /^\w*$/;
+
+/**
+ * Checks if `value` is a property name and not a property path.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {Object} [object] The object to query keys on.
+ * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
+ */
+function isKey(value, object) {
+  if (typeof value == 'number') {
+    return true;
+  }
+  return !isArray(value) &&
+    (reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
+      (object != null && value in Object(object)));
+}
+
+module.exports = isKey;