botbuilder-core
Version:
Core components for Microsoft Bot Builder. Components in this library can run either in a browser or on the server.
41 lines • 1.08 kB
JavaScript
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeRevocable = exports.shallowCopy = void 0;
/**
* @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 (typeof Proxy !== 'undefined' && Proxy.revocable) {
return Proxy.revocable(target, handler || {});
}
else {
return {
proxy: target,
revoke: () => {
// noop
},
};
}
}
exports.makeRevocable = makeRevocable;
//# sourceMappingURL=internal.js.map
;