Sha256: 00ee0589c115ddaf08111f4d28c8619f8a248d48ce1bc158be2d23a57f7e6aa4
Contents?: true
Size: 673 Bytes
Versions: 69
Compression:
Stored size: 673 Bytes
Contents
define(['../lang/isFunction'], function (isFunction) { /** * Creates an object that holds a lookup for the objects in the array. */ function toLookup(arr, key) { var result = {}; if (arr == null) { return result; } var i = -1, len = arr.length, value; if (isFunction(key)) { while (++i < len) { value = arr[i]; result[key(value)] = value; } } else { while (++i < len) { value = arr[i]; result[value[key]] = value; } } return result; } return toLookup; });
Version data entries
69 entries across 69 versions & 2 rubygems