mirror of
https://github.com/azure/login.git
synced 2026-06-06 21:17:09 +00:00
* Bump lodash from 4.17.15 to 4.17.19 (#52) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Amruta Kawade <65217380+AmrutaKawade@users.noreply.github.com> * Bump @actions/core from 1.1.3 to 1.2.6 (#60) Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.1.3 to 1.2.6. - [Release notes](https://github.com/actions/toolkit/releases) - [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Amruta Kawade <65217380+AmrutaKawade@users.noreply.github.com> * updating node_nodules * updated package-lock Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
86 lines
2.2 KiB
JavaScript
86 lines
2.2 KiB
JavaScript
"use strict";
|
|
|
|
// Returns "Type(value) is Object" in ES terminology.
|
|
function isObject(value) {
|
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
}
|
|
|
|
function getReferenceToBytes(bufferSource) {
|
|
// Node.js' Buffer does not allow subclassing for now, so we can get away with a prototype object check for perf.
|
|
if (Object.getPrototypeOf(bufferSource) === Buffer.prototype) {
|
|
return bufferSource;
|
|
}
|
|
if (bufferSource instanceof ArrayBuffer) {
|
|
return Buffer.from(bufferSource);
|
|
}
|
|
return Buffer.from(bufferSource.buffer, bufferSource.byteOffset, bufferSource.byteLength);
|
|
}
|
|
|
|
function getCopyToBytes(bufferSource) {
|
|
return Buffer.from(getReferenceToBytes(bufferSource));
|
|
}
|
|
|
|
function mixin(target, source) {
|
|
const keys = Object.getOwnPropertyNames(source);
|
|
for (let i = 0; i < keys.length; ++i) {
|
|
if (keys[i] in target) {
|
|
continue;
|
|
}
|
|
|
|
Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i]));
|
|
}
|
|
}
|
|
|
|
const wrapperSymbol = Symbol("wrapper");
|
|
const implSymbol = Symbol("impl");
|
|
const sameObjectCaches = Symbol("SameObject caches");
|
|
|
|
function getSameObject(wrapper, prop, creator) {
|
|
if (!wrapper[sameObjectCaches]) {
|
|
wrapper[sameObjectCaches] = Object.create(null);
|
|
}
|
|
|
|
if (prop in wrapper[sameObjectCaches]) {
|
|
return wrapper[sameObjectCaches][prop];
|
|
}
|
|
|
|
wrapper[sameObjectCaches][prop] = creator();
|
|
return wrapper[sameObjectCaches][prop];
|
|
}
|
|
|
|
function wrapperForImpl(impl) {
|
|
return impl ? impl[wrapperSymbol] : null;
|
|
}
|
|
|
|
function implForWrapper(wrapper) {
|
|
return wrapper ? wrapper[implSymbol] : null;
|
|
}
|
|
|
|
function tryWrapperForImpl(impl) {
|
|
const wrapper = wrapperForImpl(impl);
|
|
return wrapper ? wrapper : impl;
|
|
}
|
|
|
|
function tryImplForWrapper(wrapper) {
|
|
const impl = implForWrapper(wrapper);
|
|
return impl ? impl : wrapper;
|
|
}
|
|
|
|
const iterInternalSymbol = Symbol("internal");
|
|
const IteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
|
|
|
|
module.exports = exports = {
|
|
isObject,
|
|
getReferenceToBytes,
|
|
getCopyToBytes,
|
|
mixin,
|
|
wrapperSymbol,
|
|
implSymbol,
|
|
getSameObject,
|
|
wrapperForImpl,
|
|
implForWrapper,
|
|
tryWrapperForImpl,
|
|
tryImplForWrapper,
|
|
iterInternalSymbol,
|
|
IteratorPrototype
|
|
};
|