Fix bin/publish: use correct .env path for rspade_system Fix bin/publish script: prevent grep exit code 1 from terminating script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
23 lines
518 B
JavaScript
Executable File
23 lines
518 B
JavaScript
Executable File
'use strict';
|
|
|
|
var nestedValue = require('../helpers/nestedValue');
|
|
|
|
var _require = require('../helpers/is'),
|
|
isFunction = _require.isFunction;
|
|
|
|
module.exports = function keyBy(key) {
|
|
var collection = {};
|
|
|
|
if (isFunction(key)) {
|
|
this.items.forEach(function (item) {
|
|
collection[key(item)] = item;
|
|
});
|
|
} else {
|
|
this.items.forEach(function (item) {
|
|
var keyValue = nestedValue(item, key);
|
|
collection[keyValue || ''] = item;
|
|
});
|
|
}
|
|
|
|
return new this.constructor(collection);
|
|
}; |