mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 20:30:04 +02:00
update modules
This commit is contained in:
85
node_modules/domexception/lib/utils.js
generated
vendored
85
node_modules/domexception/lib/utils.js
generated
vendored
@@ -5,35 +5,14 @@ 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]));
|
||||
}
|
||||
function hasOwn(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
}
|
||||
|
||||
const wrapperSymbol = Symbol("wrapper");
|
||||
const implSymbol = Symbol("impl");
|
||||
const sameObjectCaches = Symbol("SameObject caches");
|
||||
const ctorRegistrySymbol = Symbol.for("[webidl2js] constructor registry");
|
||||
|
||||
function getSameObject(wrapper, prop, creator) {
|
||||
if (!wrapper[sameObjectCaches]) {
|
||||
@@ -69,18 +48,68 @@ function tryImplForWrapper(wrapper) {
|
||||
const iterInternalSymbol = Symbol("internal");
|
||||
const IteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
|
||||
|
||||
function isArrayIndexPropName(P) {
|
||||
if (typeof P !== "string") {
|
||||
return false;
|
||||
}
|
||||
const i = P >>> 0;
|
||||
if (i === Math.pow(2, 32) - 1) {
|
||||
return false;
|
||||
}
|
||||
const s = `${i}`;
|
||||
if (P !== s) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const byteLengthGetter =
|
||||
Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
||||
function isArrayBuffer(value) {
|
||||
try {
|
||||
byteLengthGetter.call(value);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const supportsPropertyIndex = Symbol("supports property index");
|
||||
const supportedPropertyIndices = Symbol("supported property indices");
|
||||
const supportsPropertyName = Symbol("supports property name");
|
||||
const supportedPropertyNames = Symbol("supported property names");
|
||||
const indexedGet = Symbol("indexed property get");
|
||||
const indexedSetNew = Symbol("indexed property set new");
|
||||
const indexedSetExisting = Symbol("indexed property set existing");
|
||||
const namedGet = Symbol("named property get");
|
||||
const namedSetNew = Symbol("named property set new");
|
||||
const namedSetExisting = Symbol("named property set existing");
|
||||
const namedDelete = Symbol("named property delete");
|
||||
|
||||
module.exports = exports = {
|
||||
isObject,
|
||||
getReferenceToBytes,
|
||||
getCopyToBytes,
|
||||
mixin,
|
||||
hasOwn,
|
||||
wrapperSymbol,
|
||||
implSymbol,
|
||||
getSameObject,
|
||||
ctorRegistrySymbol,
|
||||
wrapperForImpl,
|
||||
implForWrapper,
|
||||
tryWrapperForImpl,
|
||||
tryImplForWrapper,
|
||||
iterInternalSymbol,
|
||||
IteratorPrototype
|
||||
IteratorPrototype,
|
||||
isArrayBuffer,
|
||||
isArrayIndexPropName,
|
||||
supportsPropertyIndex,
|
||||
supportedPropertyIndices,
|
||||
supportsPropertyName,
|
||||
supportedPropertyNames,
|
||||
indexedGet,
|
||||
indexedSetNew,
|
||||
indexedSetExisting,
|
||||
namedGet,
|
||||
namedSetNew,
|
||||
namedSetExisting,
|
||||
namedDelete
|
||||
};
|
||||
|
Reference in New Issue
Block a user