bare-script 2.2.5 → 2.2.7

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/bare.js CHANGED
@@ -89,7 +89,7 @@ export async function main(options) {
89
89
  // Run the bare-script linter?
90
90
  if (args.static || args.debug) {
91
91
  const warnings = lintScript(script);
92
- const warningPrefix = `BareScript: Static analysis...`;
92
+ const warningPrefix = `BareScript: Static analysis "${file}" ...`;
93
93
  if (warnings.length === 0) {
94
94
  options.logFn(`${warningPrefix} OK`);
95
95
  } else {
package/lib/library.js CHANGED
@@ -135,6 +135,13 @@ export const scriptFunctions = {
135
135
  return value;
136
136
  },
137
137
 
138
+ // $function: arrayShift
139
+ // $group: Array
140
+ // $doc: Remove the first element of the array and return it
141
+ // $arg array: The array
142
+ // $return: The first element of the array; null if the array is empty.
143
+ 'arrayShift': ([array]) => (Array.isArray(array) ? array.shift() ?? null : null),
144
+
138
145
  // $function: arraySlice
139
146
  // $group: Array
140
147
  // $doc: Copy a portion of an array
@@ -961,6 +968,15 @@ export const scriptFunctions = {
961
968
  }
962
969
  },
963
970
 
971
+ // $function: systemPartial
972
+ // $group: System
973
+ // $doc: Return a new function which behaves like "func" called with "args".
974
+ // $doc: If additional arguments are passed to the returned function, they are appended to "args".
975
+ // $arg func: The function
976
+ // $arg args: The function arguments
977
+ // $return: The new function called with "args"
978
+ 'systemPartial': ([func, ...args]) => (argsExtra, options) => func([...args, ...argsExtra], options),
979
+
964
980
 
965
981
  //
966
982
  // URL functions
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "bare-script",
4
- "version": "2.2.5",
4
+ "version": "2.2.7",
5
5
  "description": "BareScript; a lightweight scripting and expression language",
6
6
  "keywords": [
7
7
  "expression",