node-nlp
Version:
Library for NLU (Natural Language Understanding) done in Node.js
37 lines • 966 B
JavaScript
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @private
*/
function shallowCopy(value) {
if (Array.isArray(value)) {
return value.slice(0);
}
if (typeof value === 'object') {
return Object.assign({}, value);
}
return value;
}
exports.shallowCopy = shallowCopy;
/**
* @private
* @param target a thing that will be made revocable
* @param handler an object that defines the way the new revocable object works
*/
function makeRevocable(target, handler) {
// Ensure proxy supported (some browsers don't)
if (Proxy && Proxy.revocable) {
return Proxy.revocable(target, handler || {});
}
else {
return { proxy: target, revoke: () => {
// noop
} };
}
}
exports.makeRevocable = makeRevocable;
//# sourceMappingURL=internal.js.map
;