mirror of
https://github.com/actions/labeler
synced 2026-05-07 19:11:02 +02:00
build
This commit is contained in:
144
node_modules/make-error/index.js
generated
vendored
144
node_modules/make-error/index.js
generated
vendored
@@ -1,68 +1,65 @@
|
||||
// ISC @ Julien Fontanet
|
||||
|
||||
'use strict'
|
||||
"use strict";
|
||||
|
||||
// ===================================================================
|
||||
|
||||
var construct = typeof Reflect !== 'undefined' ? Reflect.construct : undefined
|
||||
var defineProperty = Object.defineProperty
|
||||
var construct = typeof Reflect !== "undefined" ? Reflect.construct : undefined;
|
||||
var defineProperty = Object.defineProperty;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
var captureStackTrace = Error.captureStackTrace
|
||||
var captureStackTrace = Error.captureStackTrace;
|
||||
if (captureStackTrace === undefined) {
|
||||
captureStackTrace = function captureStackTrace (error) {
|
||||
var container = new Error()
|
||||
captureStackTrace = function captureStackTrace(error) {
|
||||
var container = new Error();
|
||||
|
||||
defineProperty(error, 'stack', {
|
||||
defineProperty(error, "stack", {
|
||||
configurable: true,
|
||||
get: function getStack () {
|
||||
var stack = container.stack
|
||||
get: function getStack() {
|
||||
var stack = container.stack;
|
||||
|
||||
// Replace property with value for faster future accesses.
|
||||
defineProperty(this, 'stack', {
|
||||
defineProperty(this, "stack", {
|
||||
configurable: true,
|
||||
value: stack,
|
||||
writable: true
|
||||
})
|
||||
writable: true,
|
||||
});
|
||||
|
||||
return stack
|
||||
return stack;
|
||||
},
|
||||
set: function setStack (stack) {
|
||||
defineProperty(error, 'stack', {
|
||||
set: function setStack(stack) {
|
||||
defineProperty(error, "stack", {
|
||||
configurable: true,
|
||||
value: stack,
|
||||
writable: true
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
writable: true,
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
function BaseError (message) {
|
||||
function BaseError(message) {
|
||||
if (message !== undefined) {
|
||||
defineProperty(this, 'message', {
|
||||
defineProperty(this, "message", {
|
||||
configurable: true,
|
||||
value: message,
|
||||
writable: true
|
||||
})
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
|
||||
var cname = this.constructor.name
|
||||
if (
|
||||
cname !== undefined &&
|
||||
cname !== this.name
|
||||
) {
|
||||
defineProperty(this, 'name', {
|
||||
var cname = this.constructor.name;
|
||||
if (cname !== undefined && cname !== this.name) {
|
||||
defineProperty(this, "name", {
|
||||
configurable: true,
|
||||
value: cname,
|
||||
writable: true
|
||||
})
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
|
||||
captureStackTrace(this, this.constructor)
|
||||
captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
||||
BaseError.prototype = Object.create(Error.prototype, {
|
||||
@@ -70,65 +67,72 @@ BaseError.prototype = Object.create(Error.prototype, {
|
||||
constructor: {
|
||||
configurable: true,
|
||||
value: BaseError,
|
||||
writable: true
|
||||
}
|
||||
})
|
||||
writable: true,
|
||||
},
|
||||
});
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// Sets the name of a function if possible (depends of the JS engine).
|
||||
var setFunctionName = (function () {
|
||||
function setFunctionName (fn, name) {
|
||||
return defineProperty(fn, 'name', {
|
||||
var setFunctionName = (function() {
|
||||
function setFunctionName(fn, name) {
|
||||
return defineProperty(fn, "name", {
|
||||
configurable: true,
|
||||
value: name
|
||||
})
|
||||
value: name,
|
||||
});
|
||||
}
|
||||
try {
|
||||
var f = function () {}
|
||||
setFunctionName(f, 'foo')
|
||||
if (f.name === 'foo') {
|
||||
return setFunctionName
|
||||
var f = function() {};
|
||||
setFunctionName(f, "foo");
|
||||
if (f.name === "foo") {
|
||||
return setFunctionName;
|
||||
}
|
||||
} catch (_) {}
|
||||
})()
|
||||
})();
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
function makeError (constructor, super_) {
|
||||
function makeError(constructor, super_) {
|
||||
if (super_ == null || super_ === Error) {
|
||||
super_ = BaseError
|
||||
} else if (typeof super_ !== 'function') {
|
||||
throw new TypeError('super_ should be a function')
|
||||
super_ = BaseError;
|
||||
} else if (typeof super_ !== "function") {
|
||||
throw new TypeError("super_ should be a function");
|
||||
}
|
||||
|
||||
var name
|
||||
if (typeof constructor === 'string') {
|
||||
name = constructor
|
||||
constructor = construct !== undefined
|
||||
? function () { return construct(super_, arguments, this.constructor) }
|
||||
: function () { super_.apply(this, arguments) }
|
||||
var name;
|
||||
if (typeof constructor === "string") {
|
||||
name = constructor;
|
||||
constructor =
|
||||
construct !== undefined
|
||||
? function() {
|
||||
return construct(super_, arguments, this.constructor);
|
||||
}
|
||||
: function() {
|
||||
super_.apply(this, arguments);
|
||||
};
|
||||
|
||||
// If the name can be set, do it once and for all.
|
||||
if (setFunctionName !== undefined) {
|
||||
setFunctionName(constructor, name)
|
||||
name = undefined
|
||||
setFunctionName(constructor, name);
|
||||
name = undefined;
|
||||
}
|
||||
} else if (typeof constructor !== 'function') {
|
||||
throw new TypeError('constructor should be either a string or a function')
|
||||
} else if (typeof constructor !== "function") {
|
||||
throw new TypeError("constructor should be either a string or a function");
|
||||
}
|
||||
|
||||
// Also register the super constructor also as `constructor.super_` just
|
||||
// like Node's `util.inherits()`.
|
||||
constructor.super_ = constructor['super'] = super_
|
||||
//
|
||||
// eslint-disable-next-line dot-notation
|
||||
constructor.super_ = constructor["super"] = super_;
|
||||
|
||||
var properties = {
|
||||
constructor: {
|
||||
configurable: true,
|
||||
value: constructor,
|
||||
writable: true
|
||||
}
|
||||
}
|
||||
writable: true,
|
||||
},
|
||||
};
|
||||
|
||||
// If the name could not be set on the constructor, set it on the
|
||||
// prototype.
|
||||
@@ -136,12 +140,12 @@ function makeError (constructor, super_) {
|
||||
properties.name = {
|
||||
configurable: true,
|
||||
value: name,
|
||||
writable: true
|
||||
}
|
||||
writable: true,
|
||||
};
|
||||
}
|
||||
constructor.prototype = Object.create(super_.prototype, properties)
|
||||
constructor.prototype = Object.create(super_.prototype, properties);
|
||||
|
||||
return constructor
|
||||
return constructor;
|
||||
}
|
||||
exports = module.exports = makeError
|
||||
exports.BaseError = BaseError
|
||||
exports = module.exports = makeError;
|
||||
exports.BaseError = BaseError;
|
||||
|
||||
Reference in New Issue
Block a user