Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
escapeUnescaped: function(string, charsToEscape = '"') {
let charsRegExp, split;
charsRegExp = RegExp(
`([${Caf.toString(escapeRegExp(charsToEscape))}])`,
"g"
);
split = charsToEscape.match(/\\/)
? [string]
: string.split(/((?:\\.)+)/);
return Caf.array(split, (str, i) =>
Caf.mod(i, 2) === 0 ? str.replace(charsRegExp, "\\$1") : str
).join("");
},
legalUnquotedPropName: (legalUnquotedPropName = /^(0|[1-9][0-9]*|[a-z_][0-9_a-z]*)$/i),
deescapeSpaces: (deescapeSpaces = function(string) {
return Caf.array(string.split(/((?:\\\\)+)/), (str, i) =>
Caf.mod(i, 2) === 0 ? str.replace(/\\[_ ]/g, " ") : str
).join("");
}),
escapeNewLines: function(string) {
this.prototype.getBareInitializers = function() {
let identifiers;
this.bindAllUniqueIdentifiersRequested();
return this._identifiersAssigned &&
(identifiers = this.requiredIdentifierLets).length > 0
? ((identifiers = Caf.array(identifiers, null, identifier =>
identifier.match(/=/)
)),
identifiers.length > 0
? `${Caf.toString(identifiers.join("; "))}`
: undefined)
: undefined;
};
this.prototype.updateScope = function(scope) {
FunctionDefinitionArgStn(
IdentifierStn({ identifier: className })
),
FunctionDefinitionArgStn(
IdentifierStn({
identifier: (classSuperHandle = "classSuper")
})
),
FunctionDefinitionArgStn(
IdentifierStn({
identifier: (instanceSuperHandle = "instanceSuper")
})
)
),
StatementsStn(
(statementsToCount = Caf.array(body.children, stn =>
stn.type === "Object"
? Caf.array(stn.children, objectPropValueStn => {
let propNameStn,
propValueStn,
assignToStn,
propName,
isThisProp;
[
propNameStn,
propValueStn
] = objectPropValueStn.children;
assignToStn = (() => {
switch (propNameStn.type) {
case "ObjectPropName":
({ propName, isThisProp } = propNameStn);
return isThisProp
FunctionDefinitionArgStn(
IdentifierStn({ identifier: className })
),
FunctionDefinitionArgStn(
IdentifierStn({
identifier: (classSuperHandle = "classSuper")
})
),
FunctionDefinitionArgStn(
IdentifierStn({
identifier: (instanceSuperHandle = "instanceSuper")
})
)
),
StatementsStn(
(statementsToCount = Caf.array(
body.children,
stn =>
stn.type === "Object"
? Caf.array(stn.children, objectPropValueStn => {
let propNameStn,
propValueStn,
assignToStn,
propName,
isThisProp;
[
propNameStn,
propValueStn
] = objectPropValueStn.children;
assignToStn = (() => {
switch (propNameStn.type) {
case "ObjectPropName":
return (() => {
throw new Error(
`not supported yet: ${Caf.toString(outputType)}`
);
})();
}
this.prototype.toJs = function(options = {}) {
let returnExpression, body, optionalCatch;
({ returnExpression } = options);
({ body, optionalCatch } = this.labeledChildren);
body = returnExpression ? body.toFunctionBodyJs() : body.toJs();
optionalCatch = Caf.exists(optionalCatch) &&
optionalCatch.toJs(options) ||
"catch (cafError) {}";
return `try {${Caf.toString(body)};} ${Caf.toString(optionalCatch)}`;
};
this.prototype.toJsExpression = function() {
this.prototype.toJs = function(options = {}) {
let expression, body, optionalCatch, js;
({ expression } = options);
({ body, optionalCatch } = this.labeledChildren);
body = expression ? body.toFunctionBodyJs() : body.toJs();
optionalCatch = Caf.exists(optionalCatch) &&
optionalCatch.toJs(options) ||
"catch (cafError) {}";
js = `try {${Caf.toString(body)};} ${Caf.toString(optionalCatch)}`;
return expression ? this.doJs(null, js) : js;
};
}
"use strict";
let Caf = require("caffeine-script-runtime");
Caf.defMod(module, () => {
let ThrowStn;
return ThrowStn = Caf.defClass(
class ThrowStn extends require("../BaseStn") {},
function(ThrowStn, classSuper, instanceSuper) {
this.prototype.toJs = function(options = {}) {
return options.expression
? `(()=>{${Caf.toString(this.toJs())};})()`
: `throw ${Caf.toString(this.childrenToJs())}`;
};
}
);
});
"use strict";
let Caf = require("caffeine-script-runtime");
Caf.defMod(module, () => {
return (() => {
let ArraySpreadElementStn;
return (ArraySpreadElementStn = Caf.defClass(
class ArraySpreadElementStn extends require("../BaseStn") {},
function(ArraySpreadElementStn, classSuper, instanceSuper) {
this.prototype.toSourceNode = function() {
return this.createSourceNode("...", this.childrenToSourceNodes());
};
}
));
})();
});