undefined -> void 0 in helper

This commit is contained in:
Nicolò Ribaudo 2022-01-08 23:52:24 +01:00
parent 9cd2c7886e
commit b86c25a800
2 changed files with 17 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@ -25,16 +25,16 @@ function createMetadataMethodsForProperty(metadataMap, kind, property) {
var metadataForKey = metadataMap[key]; var metadataForKey = metadataMap[key];
if (metadataForKey === undefined) return undefined; if (metadataForKey === void 0) return void 0;
if (kind === 1 /* PUBLIC */) { if (kind === 1 /* PUBLIC */) {
var pub = metadataForKey.public; var pub = metadataForKey.public;
if (pub !== undefined) { if (pub !== void 0) {
return pub[property]; return pub[property];
} }
} else if (kind === 2 /* PRIVATE */) { } else if (kind === 2 /* PRIVATE */) {
var priv = metadataForKey.private; var priv = metadataForKey.private;
if (priv !== undefined) { if (priv !== void 0) {
return priv.get(property); return priv.get(property);
} }
} else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) { } else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) {
@ -48,14 +48,14 @@ function createMetadataMethodsForProperty(metadataMap, kind, property) {
var metadataForKey = metadataMap[key]; var metadataForKey = metadataMap[key];
if (metadataForKey === undefined) { if (metadataForKey === void 0) {
metadataForKey = metadataMap[key] = {}; metadataForKey = metadataMap[key] = {};
} }
if (kind === 1 /* PUBLIC */) { if (kind === 1 /* PUBLIC */) {
var pub = metadataForKey.public; var pub = metadataForKey.public;
if (pub === undefined) { if (pub === void 0) {
pub = metadataForKey.public = Object.create(null); pub = metadataForKey.public = Object.create(null);
} }
@ -63,7 +63,7 @@ function createMetadataMethodsForProperty(metadataMap, kind, property) {
} else if (kind === 2 /* PRIVATE */) { } else if (kind === 2 /* PRIVATE */) {
var priv = metadataForKey.priv; var priv = metadataForKey.priv;
if (priv === undefined) { if (priv === void 0) {
priv = metadataForKey.private = new Map(); priv = metadataForKey.private = new Map();
} }
@ -219,16 +219,16 @@ function assertValidReturnValue(kind, value) {
if (kind === 1 /* ACCESSOR */) { if (kind === 1 /* ACCESSOR */) {
if (type !== "object" || value === null) { if (type !== "object" || value === null) {
throw new Error( throw new Error(
"accessor decorators must return an object with get, set, or initializer properties or undefined" "accessor decorators must return an object with get, set, or initializer properties or void 0"
); );
} }
} else if (type !== "function") { } else if (type !== "function") {
if (kind === 0 /* FIELD */) { if (kind === 0 /* FIELD */) {
throw new Error( throw new Error(
"field decorators must return a initializer function or undefined" "field decorators must return a initializer function or void 0"
); );
} else { } else {
throw new Error("method decorators must return a function or undefined"); throw new Error("method decorators must return a function or void 0");
} }
} }
} }
@ -300,7 +300,7 @@ function applyMemberDec(
if (typeof decs === "function") { if (typeof decs === "function") {
newValue = decs(value, ctx); newValue = decs(value, ctx);
if (newValue !== undefined) { if (newValue !== void 0) {
assertValidReturnValue(kind, newValue); assertValidReturnValue(kind, newValue);
if (kind === 0 /* FIELD */) { if (kind === 0 /* FIELD */) {
@ -322,7 +322,7 @@ function applyMemberDec(
newValue = dec(value, ctx); newValue = dec(value, ctx);
if (newValue !== undefined) { if (newValue !== void 0) {
assertValidReturnValue(kind, newValue); assertValidReturnValue(kind, newValue);
var newInit; var newInit;
@ -339,8 +339,8 @@ function applyMemberDec(
value = newValue; value = newValue;
} }
if (newInit !== undefined) { if (newInit !== void 0) {
if (initializer === undefined) { if (initializer === void 0) {
initializer = newInit; initializer = newInit;
} else if (typeof initializer === "function") { } else if (typeof initializer === "function") {
initializer = [initializer, newInit]; initializer = [initializer, newInit];
@ -353,8 +353,8 @@ function applyMemberDec(
} }
if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) { if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
if (initializer === undefined) { if (initializer === void 0) {
// If the initializer was undefined, sub in a dummy initializer // If the initializer was void 0, sub in a dummy initializer
initializer = function (instance, init) { initializer = function (instance, init) {
return init; return init;
}; };
@ -566,7 +566,7 @@ function applyClassDecs(ret, targetClass, metadataMap, classDecs) {
dec, // dec or array of decs dec, // dec or array of decs
0, // kind of value being decorated 0, // kind of value being decorated
'prop', // name of public prop on class containing the value being decorated, 'prop', // name of public prop on class containing the value being decorated,
'#p', // the name of the private property (if is private, undefined otherwise), '#p', // the name of the private property (if is private, void 0 otherwise),
] ]
], ],
[ [