bare-script 3.0.12 → 3.0.14

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 CHANGED
@@ -40,6 +40,26 @@ const arrayCopyArgs = valueArgsModel([
40
40
  ]);
41
41
 
42
42
 
43
+ // $function: arrayDelete
44
+ // $group: Array
45
+ // $doc: Delete an array element
46
+ // $arg array: The array
47
+ // $arg index: The index of the element to delete
48
+ function arrayDelete(args) {
49
+ const [array, index] = valueArgsValidate(arrayDeleteArgs, args);
50
+ if (index >= array.length) {
51
+ throw new ValueArgsError('index', index);
52
+ }
53
+
54
+ array.splice(index, 1);
55
+ }
56
+
57
+ const arrayDeleteArgs = valueArgsModel([
58
+ {'name': 'array', 'type': 'array'},
59
+ {'name': 'index', 'type': 'number', 'integer': true, 'gte': 0}
60
+ ]);
61
+
62
+
43
63
  // $function: arrayExtend
44
64
  // $group: Array
45
65
  // $doc: Extend one array with another
@@ -2057,6 +2077,7 @@ const urlEncodeComponentArgs = valueArgsModel([
2057
2077
  // The built-in script functions
2058
2078
  export const scriptFunctions = {
2059
2079
  arrayCopy,
2080
+ arrayDelete,
2060
2081
  arrayExtend,
2061
2082
  arrayGet,
2062
2083
  arrayIndexOf,
package/lib/value.js CHANGED
@@ -390,25 +390,25 @@ struct FunctionArgument
390
390
  optional bool nullable
391
391
 
392
392
  # The default argument value
393
- optional object default
393
+ optional any default
394
394
 
395
395
  # If true, this argument is the array of remaining arguments
396
- optional object lastArgArray
396
+ optional bool lastArgArray
397
397
 
398
398
  # If true, the number argument must be an integer
399
399
  optional bool integer
400
400
 
401
401
  # The number argument must be less-than
402
- optional object lt
402
+ optional any lt
403
403
 
404
404
  # The number argument must be less-than-or-equal-to
405
- optional object lte
405
+ optional any lte
406
406
 
407
407
  # The number argument must be greater-than
408
- optional object gt
408
+ optional any gt
409
409
 
410
410
  # The number argument must be greater-than-or-equal-to
411
- optional object gte
411
+ optional any gte
412
412
 
413
413
 
414
414
  # The function argument types
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "bare-script",
4
- "version": "3.0.12",
4
+ "version": "3.0.14",
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": "~10.1",
34
- "eslint": "~9.9",
34
+ "eslint": "~9.14",
35
35
  "jsdoc": "~4.0"
36
36
  }
37
37
  }