@johngw/stream
Version:
Reactive programming tools using the WHATWG Streams API.
15 lines • 468 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.label = void 0;
const map_1 = require("@johngw/stream/transformers/map");
function label(propNameOrFn) {
const getKey = typeof propNameOrFn === 'function'
? propNameOrFn
: (chunk) => chunk[propNameOrFn];
return (0, map_1.map)((chunk) => ({
label: getKey(chunk),
value: chunk,
}));
}
exports.label = label;
//# sourceMappingURL=label.js.map