@digipair/skill-basic 0.104.0 → 0.105.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +113 -57
- package/package.json +1 -1
package/index.esm.js
CHANGED
@@ -23899,14 +23899,14 @@ function indent(str, spaces) {
|
|
23899
23899
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
23900
23900
|
// match is required
|
23901
23901
|
if (!match) {
|
23902
|
-
return i = i1,
|
23902
|
+
return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
|
23903
23903
|
v: nextMatch1
|
23904
23904
|
};
|
23905
23905
|
}
|
23906
23906
|
var token = match.token, offset = match.offset;
|
23907
23907
|
i1 += offset;
|
23908
23908
|
if (token === " ") {
|
23909
|
-
return i = i1,
|
23909
|
+
return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
|
23910
23910
|
}
|
23911
23911
|
tokens1 = _to_consumable_array$1(tokens1).concat([
|
23912
23912
|
token
|
@@ -23925,7 +23925,7 @@ function indent(str, spaces) {
|
|
23925
23925
|
if (contextKeys.some(function(el) {
|
23926
23926
|
return el.startsWith(name);
|
23927
23927
|
})) {
|
23928
|
-
return i = i1,
|
23928
|
+
return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
|
23929
23929
|
}
|
23930
23930
|
if (dateTimeIdentifiers.some(function(el) {
|
23931
23931
|
return el === name;
|
@@ -23944,9 +23944,9 @@ function indent(str, spaces) {
|
|
23944
23944
|
if (dateTimeIdentifiers.some(function(el) {
|
23945
23945
|
return el.startsWith(name);
|
23946
23946
|
})) {
|
23947
|
-
return i = i1,
|
23947
|
+
return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
|
23948
23948
|
}
|
23949
|
-
return i = i1,
|
23949
|
+
return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
|
23950
23950
|
v: nextMatch1
|
23951
23951
|
};
|
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,SO!i~~,XO!g~~,[WOY,XZ#O,X#O#P,t#P#S,X#S#T-p#T;'S,X;'S;=`-u<%lO,X~,wRO;'S,X;'S;=`-Q;=`O,X~-TXOY,XZ#O,X#O#P,t#P#S,X#S#T-p#T;'S,X;'S;=`-u;=`<%l,X<%lO,X~-uO$Z~~-xP;=`<%l,X~.QO#S~~.VO#R~",
|
24814
24814
|
tokenizers: [
|
24815
24815
|
propertyIdentifiers,
|
24816
24816
|
identifiers,
|
@@ -25326,6 +25326,9 @@ function parseParameterNames(fn) {
|
|
25326
25326
|
function notImplemented(thing) {
|
25327
25327
|
return new Error("not implemented: ".concat(thing));
|
25328
25328
|
}
|
25329
|
+
function isNotImplemented(err) {
|
25330
|
+
return /^not implemented/.test(err.message);
|
25331
|
+
}
|
25329
25332
|
/**
|
25330
25333
|
* Returns a name from context or undefined if it does not exist.
|
25331
25334
|
*
|
@@ -25446,6 +25449,9 @@ var builtins = {
|
|
25446
25449
|
d = from;
|
25447
25450
|
}
|
25448
25451
|
if (year) {
|
25452
|
+
if (!isNumber(month) || !isNumber(day)) {
|
25453
|
+
return null;
|
25454
|
+
}
|
25449
25455
|
d = date().setZone("utc").set({
|
25450
25456
|
year: year,
|
25451
25457
|
month: month,
|
@@ -25500,7 +25506,7 @@ var builtins = {
|
|
25500
25506
|
from = hour;
|
25501
25507
|
hour = null;
|
25502
25508
|
}
|
25503
|
-
if (isString(from)) {
|
25509
|
+
if (isString(from) && from) {
|
25504
25510
|
t = date(null, from);
|
25505
25511
|
}
|
25506
25512
|
if (isDateTime(from)) {
|
@@ -25511,6 +25517,9 @@ var builtins = {
|
|
25511
25517
|
});
|
25512
25518
|
}
|
25513
25519
|
if (isNumber(hour)) {
|
25520
|
+
if (!isNumber(minute) || !isNumber(second)) {
|
25521
|
+
return null;
|
25522
|
+
}
|
25514
25523
|
// TODO: support offset = days and time duration
|
25515
25524
|
t = date().set({
|
25516
25525
|
hour: hour,
|
@@ -25620,7 +25629,8 @@ var builtins = {
|
|
25620
25629
|
"string"
|
25621
25630
|
]),
|
25622
25631
|
"replace": fn(function(input, pattern, replacement, flags) {
|
25623
|
-
|
25632
|
+
var regexp = createRegexp(pattern, flags || "", "g");
|
25633
|
+
return regexp && input.replace(regexp, replacement.replace(/\$0/g, "$$&"));
|
25624
25634
|
}, [
|
25625
25635
|
"string",
|
25626
25636
|
"string",
|
@@ -25633,9 +25643,9 @@ var builtins = {
|
|
25633
25643
|
"string",
|
25634
25644
|
"string"
|
25635
25645
|
]),
|
25636
|
-
// eslint-disable-next-line
|
25637
25646
|
"matches": fn(function(input, pattern, flags) {
|
25638
|
-
|
25647
|
+
var regexp = createRegexp(pattern, flags || "", "");
|
25648
|
+
return regexp && regexp.test(input);
|
25639
25649
|
}, [
|
25640
25650
|
"string",
|
25641
25651
|
"string",
|
@@ -25654,7 +25664,8 @@ var builtins = {
|
|
25654
25664
|
"string"
|
25655
25665
|
]),
|
25656
25666
|
"split": fn(function(string, delimiter) {
|
25657
|
-
|
25667
|
+
var regexp = createRegexp(delimiter, "", "");
|
25668
|
+
return regexp && string.split(regexp);
|
25658
25669
|
}, [
|
25659
25670
|
"string",
|
25660
25671
|
"string"
|
@@ -26570,6 +26581,35 @@ function mode(array) {
|
|
26570
26581
|
function ifValid(o) {
|
26571
26582
|
return o.isValid ? o : null;
|
26572
26583
|
}
|
26584
|
+
/**
|
26585
|
+
* Concatenates flags for a regular expression.
|
26586
|
+
*
|
26587
|
+
* Ensures that default flags are included without duplication, even if
|
26588
|
+
* user-specified flags overlap with the defaults.
|
26589
|
+
*/ function buildFlags(flags, defaultFlags) {
|
26590
|
+
var unsupportedFlags = flags.replace(/[smix]/g, "");
|
26591
|
+
if (unsupportedFlags) {
|
26592
|
+
throw new Error("illegal flags: " + unsupportedFlags);
|
26593
|
+
}
|
26594
|
+
// we don't implement the <x> flag
|
26595
|
+
if (/x/.test(flags)) {
|
26596
|
+
throw notImplemented("matches <x> flag");
|
26597
|
+
}
|
26598
|
+
return flags + defaultFlags;
|
26599
|
+
}
|
26600
|
+
/**
|
26601
|
+
* Creates a regular expression from a given pattern
|
26602
|
+
*/ function createRegexp(pattern, flags) {
|
26603
|
+
var defaultFlags = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
26604
|
+
try {
|
26605
|
+
return new RegExp(pattern, "u" + buildFlags(flags, defaultFlags));
|
26606
|
+
} catch (_err) {
|
26607
|
+
if (isNotImplemented(_err)) {
|
26608
|
+
throw _err;
|
26609
|
+
}
|
26610
|
+
}
|
26611
|
+
return null;
|
26612
|
+
}
|
26573
26613
|
function parseExpression(expression) {
|
26574
26614
|
var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, dialect = arguments.length > 2 ? arguments[2] : void 0;
|
26575
26615
|
return parser.configure({
|
@@ -27024,27 +27064,59 @@ function evalNode(node, input, args) {
|
|
27024
27064
|
};
|
27025
27065
|
case "Type":
|
27026
27066
|
return args[0];
|
27067
|
+
// (x in [ [1,2], [3,4] ]), (y in x)
|
27027
27068
|
case "InExpressions":
|
27028
27069
|
return function(context) {
|
27029
|
-
|
27030
|
-
|
27031
|
-
|
27032
|
-
|
27033
|
-
|
27034
|
-
|
27035
|
-
|
27036
|
-
|
27037
|
-
|
27038
|
-
|
27039
|
-
|
27040
|
-
|
27041
|
-
|
27042
|
-
|
27070
|
+
// we build up evaluation contexts from left to right,
|
27071
|
+
// ending up with the cartesian product over all available contexts
|
27072
|
+
//
|
27073
|
+
// previous context is provided to later context providers
|
27074
|
+
// producing <null> as a context during evaluation causes the
|
27075
|
+
// whole result to turn <null>
|
27076
|
+
var isValidContexts = function(contexts) {
|
27077
|
+
if (contexts === null || contexts.some(function(arr) {
|
27078
|
+
return getType(arr) === "nil";
|
27079
|
+
})) {
|
27080
|
+
return false;
|
27081
|
+
}
|
27082
|
+
return true;
|
27083
|
+
};
|
27084
|
+
var join = function(aContexts, bContextProducer) {
|
27085
|
+
var _instance;
|
27086
|
+
return (_instance = []).concat.apply(_instance, _to_consumable_array(aContexts.map(function(aContext) {
|
27087
|
+
var bContexts = bContextProducer(Object.assign(Object.assign({}, context), aContext));
|
27088
|
+
if (!isValidContexts(bContexts)) {
|
27089
|
+
return null;
|
27090
|
+
}
|
27091
|
+
return bContexts.map(function(bContext) {
|
27092
|
+
return Object.assign(Object.assign({}, aContext), bContext);
|
27093
|
+
});
|
27094
|
+
})));
|
27095
|
+
};
|
27096
|
+
var cartesian = function(aContexts, bContextProducer) {
|
27097
|
+
for(var _len = arguments.length, otherContextProducers = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
27098
|
+
otherContextProducers[_key - 2] = arguments[_key];
|
27099
|
+
}
|
27100
|
+
if (!isValidContexts(aContexts)) {
|
27101
|
+
return null;
|
27102
|
+
}
|
27103
|
+
if (!bContextProducer) {
|
27104
|
+
return aContexts;
|
27043
27105
|
}
|
27044
|
-
return
|
27045
|
-
|
27046
|
-
|
27047
|
-
|
27106
|
+
return cartesian.apply(void 0, [
|
27107
|
+
join(aContexts, bContextProducer)
|
27108
|
+
].concat(_to_consumable_array(otherContextProducers)));
|
27109
|
+
};
|
27110
|
+
var cartesianProduct = function(contextProducers) {
|
27111
|
+
var _contextProducers = _to_array(contextProducers), aContextProducer = _contextProducers[0], otherContextProducers = _contextProducers.slice(1);
|
27112
|
+
var aContexts = aContextProducer(context);
|
27113
|
+
return cartesian.apply(void 0, [
|
27114
|
+
aContexts
|
27115
|
+
].concat(_to_consumable_array(otherContextProducers)));
|
27116
|
+
};
|
27117
|
+
var product = cartesianProduct(args);
|
27118
|
+
return product && product.map(function(p) {
|
27119
|
+
return Object.assign(Object.assign({}, context), p);
|
27048
27120
|
});
|
27049
27121
|
};
|
27050
27122
|
// Name kw<"in"> Expr
|
@@ -27674,31 +27746,6 @@ function createDateTimeRange(start, end, startIncluded, endIncluded) {
|
|
27674
27746
|
includes: includes
|
27675
27747
|
});
|
27676
27748
|
}
|
27677
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
27678
|
-
function cartesianProduct(arrays) {
|
27679
|
-
var _instance;
|
27680
|
-
if (arrays.some(function(arr) {
|
27681
|
-
return getType(arr) === "nil";
|
27682
|
-
})) {
|
27683
|
-
return null;
|
27684
|
-
}
|
27685
|
-
var f = function(a, b) {
|
27686
|
-
return (_instance = []).concat.apply(_instance, _to_consumable_array(a.map(function(d) {
|
27687
|
-
return b.map(function(e) {
|
27688
|
-
return [].concat(d, e);
|
27689
|
-
});
|
27690
|
-
})));
|
27691
|
-
};
|
27692
|
-
var cartesian = function(a, b) {
|
27693
|
-
for(var _len = arguments.length, c = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
27694
|
-
c[_key - 2] = arguments[_key];
|
27695
|
-
}
|
27696
|
-
return b ? cartesian.apply(void 0, [
|
27697
|
-
f(a, b)
|
27698
|
-
].concat(_to_consumable_array(c))) : a || [];
|
27699
|
-
};
|
27700
|
-
return cartesian.apply(void 0, _to_consumable_array(arrays));
|
27701
|
-
}
|
27702
27749
|
function coalecenseTypes(a, b) {
|
27703
27750
|
if (!b) {
|
27704
27751
|
return a.type;
|
@@ -27760,15 +27807,24 @@ function parseString(str) {
|
|
27760
27807
|
if (str.endsWith('"')) {
|
27761
27808
|
str = str.slice(0, -1);
|
27762
27809
|
}
|
27763
|
-
return str.replace(/(\\")|(\\\\)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function(substring) {
|
27810
|
+
return str.replace(/(\\")|(\\\\)|(\\n)|(\\r)|(\\t)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function(substring) {
|
27764
27811
|
for(var _len = arguments.length, groups = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
27765
27812
|
groups[_key - 1] = arguments[_key];
|
27766
27813
|
}
|
27767
|
-
var _groups = _sliced_to_array(groups,
|
27814
|
+
var _groups = _sliced_to_array(groups, 7), quotes = _groups[0], backslash = _groups[1], newline = _groups[2], carriageReturn = _groups[3], tab = _groups[4], codePoint = _groups[5], charCodes = _groups[6];
|
27768
27815
|
if (quotes) {
|
27769
27816
|
return '"';
|
27770
27817
|
}
|
27771
|
-
if (
|
27818
|
+
if (newline) {
|
27819
|
+
return "\n";
|
27820
|
+
}
|
27821
|
+
if (carriageReturn) {
|
27822
|
+
return "\r";
|
27823
|
+
}
|
27824
|
+
if (tab) {
|
27825
|
+
return " ";
|
27826
|
+
}
|
27827
|
+
if (backslash) {
|
27772
27828
|
return "\\";
|
27773
27829
|
}
|
27774
27830
|
var escapePattern = /\\u([a-fA-F0-9]+)/ig;
|