1 var assocIndexOf = require('./_assocIndexOf');
3 /** Used for built-in method references. */
4 var arrayProto = Array.prototype;
6 /** Built-in value references. */
7 var splice = arrayProto.splice;
10 * Removes `key` and its value from the associative array.
13 * @param {Array} array The array to query.
14 * @param {string} key The key of the value to remove.
15 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
17 function assocDelete(array, key) {
18 var index = assocIndexOf(array, key);
22 var lastIndex = array.length - 1;
23 if (index == lastIndex) {
26 splice.call(array, index, 1);
31 module.exports = assocDelete;