Initial commit
[yaffs-website] / node_modules / node-sass / node_modules / lodash / _baseUnset.js
1 var castPath = require('./_castPath'),
2     isKey = require('./_isKey'),
3     last = require('./last'),
4     parent = require('./_parent'),
5     toKey = require('./_toKey');
6
7 /** Used for built-in method references. */
8 var objectProto = Object.prototype;
9
10 /** Used to check objects for own properties. */
11 var hasOwnProperty = objectProto.hasOwnProperty;
12
13 /**
14  * The base implementation of `_.unset`.
15  *
16  * @private
17  * @param {Object} object The object to modify.
18  * @param {Array|string} path The path of the property to unset.
19  * @returns {boolean} Returns `true` if the property is deleted, else `false`.
20  */
21 function baseUnset(object, path) {
22   path = isKey(path, object) ? [path] : castPath(path);
23   object = parent(object, path);
24
25   var key = toKey(last(path));
26   return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
27 }
28
29 module.exports = baseUnset;