bare-script 3.0.8 → 3.0.10
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/lib/library.js +13 -5
- package/lib/parser.js +1 -1
- package/lib/runtimeAsync.js +1 -1
- package/package.json +2 -2
package/lib/library.js
CHANGED
|
@@ -342,7 +342,7 @@ const arraySortArgs = valueArgsModel([
|
|
|
342
342
|
// $group: Data
|
|
343
343
|
// $doc: Aggregate a data array
|
|
344
344
|
// $arg data: The data array
|
|
345
|
-
// $arg aggregation: The [aggregation model](model.html#var.vName='Aggregation')
|
|
345
|
+
// $arg aggregation: The [aggregation model](https://craigahobbs.github.io/bare-script/library/model.html#var.vName='Aggregation')
|
|
346
346
|
// $return: The aggregated data array
|
|
347
347
|
function dataAggregate(args) {
|
|
348
348
|
const [data, aggregation] = valueArgsValidate(dataAggregateArgs, args);
|
|
@@ -1256,7 +1256,8 @@ const rRegexEscape = /[.*+?^${}()|[\]\\]/g;
|
|
|
1256
1256
|
// $doc: Find the first match of a regular expression in a string
|
|
1257
1257
|
// $arg regex: The regular expression
|
|
1258
1258
|
// $arg string: The string
|
|
1259
|
-
// $return: The [match object](model.html#var.vName='RegexMatch'),
|
|
1259
|
+
// $return: The [match object](https://craigahobbs.github.io/bare-script/library/model.html#var.vName='RegexMatch'),
|
|
1260
|
+
// $return: or null if no matches are found
|
|
1260
1261
|
function regexMatch(args) {
|
|
1261
1262
|
const [regex, string] = valueArgsValidate(regexMatchArgs, args);
|
|
1262
1263
|
const match = string.match(regex);
|
|
@@ -1274,7 +1275,7 @@ const regexMatchArgs = valueArgsModel([
|
|
|
1274
1275
|
// $doc: Find all matches of regular expression in a string
|
|
1275
1276
|
// $arg regex: The regular expression
|
|
1276
1277
|
// $arg string: The string
|
|
1277
|
-
// $return: The array of [match objects](model.html#var.vName='RegexMatch')
|
|
1278
|
+
// $return: The array of [match objects](https://craigahobbs.github.io/bare-script/library/model.html#var.vName='RegexMatch')
|
|
1278
1279
|
function regexMatchAll(args) {
|
|
1279
1280
|
const [regex, string] = valueArgsValidate(regexMatchAllArgs, args);
|
|
1280
1281
|
const regexGlobal = regexEnsureGlobal(regex);
|
|
@@ -1808,8 +1809,10 @@ function systemCompare([left = null, right = null]) {
|
|
|
1808
1809
|
// $function: systemFetch
|
|
1809
1810
|
// $group: System
|
|
1810
1811
|
// $doc: Retrieve a URL resource
|
|
1811
|
-
// $arg url: The resource URL,
|
|
1812
|
-
// $arg url: [request model](model.html#var.vName='SystemFetchRequest')
|
|
1812
|
+
// $arg url: The resource URL,
|
|
1813
|
+
// $arg url: [request model](https://craigahobbs.github.io/bare-script/library/model.html#var.vName='SystemFetchRequest'),
|
|
1814
|
+
// $arg url: or array of URL and
|
|
1815
|
+
// $arg url: [request model](https://craigahobbs.github.io/bare-script/library/model.html#var.vName='SystemFetchRequest')
|
|
1813
1816
|
// $return: The response string or array of strings; null if an error occurred
|
|
1814
1817
|
async function systemFetch([url = null], options) {
|
|
1815
1818
|
// Options
|
|
@@ -1844,6 +1847,7 @@ async function systemFetch([url = null], options) {
|
|
|
1844
1847
|
const fetchURL = urlFn !== null ? urlFn(request.url) : request.url;
|
|
1845
1848
|
const fetchOptions = {};
|
|
1846
1849
|
if ((request.body ?? null) !== null) {
|
|
1850
|
+
fetchOptions.method = 'POST';
|
|
1847
1851
|
fetchOptions.body = request.body;
|
|
1848
1852
|
}
|
|
1849
1853
|
if ((request.headers ?? null) !== null) {
|
|
@@ -1979,6 +1983,10 @@ function systemPartial(args) {
|
|
|
1979
1983
|
throw new ValueArgsError('args', funcArgs);
|
|
1980
1984
|
}
|
|
1981
1985
|
|
|
1986
|
+
if (func.constructor.name === 'AsyncFunction') {
|
|
1987
|
+
// eslint-disable-next-line require-await
|
|
1988
|
+
return async (argsExtra, options) => func([...funcArgs, ...argsExtra], options);
|
|
1989
|
+
}
|
|
1982
1990
|
return (argsExtra, options) => func([...funcArgs, ...argsExtra], options);
|
|
1983
1991
|
}
|
|
1984
1992
|
|
package/lib/parser.js
CHANGED
|
@@ -589,7 +589,7 @@ function parseUnaryExpression(exprText) {
|
|
|
589
589
|
if (matchFunctionOpen !== null) {
|
|
590
590
|
let argText = exprText.slice(matchFunctionOpen[0].length);
|
|
591
591
|
const args = [];
|
|
592
|
-
while (true) {
|
|
592
|
+
while (true) {
|
|
593
593
|
// Function close?
|
|
594
594
|
const matchFunctionClose = argText.match(rExprFunctionClose);
|
|
595
595
|
if (matchFunctionClose !== null) {
|
package/lib/runtimeAsync.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "bare-script",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.10",
|
|
5
5
|
"description": "BareScript; a lightweight scripting and expression language",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"expression",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"c8": "~9.1",
|
|
34
|
-
"eslint": "~
|
|
34
|
+
"eslint": "~9.1",
|
|
35
35
|
"jsdoc": "~4.0"
|
|
36
36
|
}
|
|
37
37
|
}
|