fast-iterable
Version:
Provides LINQ-like fluent api operations for iterables and async iterables (ES2018+).
14 lines (13 loc) • 563 B
JavaScript
;
/* eslint-disable guard-for-in */
Object.defineProperty(exports, "__esModule", { value: true });
exports.addCustomMethod = void 0;
const fluent_1 = require("./fluent");
const utils_1 = require("./utils");
function addCustomMethod(proxyReference, methods) {
if ((0, fluent_1.default)((0, utils_1.iterateObjProps)(methods)).any(proxyReference.hasOwnProperty.bind(proxyReference))) {
throw new Error(`There is already a method called ${name}`);
}
Object.assign(proxyReference, methods);
}
exports.addCustomMethod = addCustomMethod;