bare-script 3.8.18 → 3.8.19
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/include/args.bare +1 -1
- package/lib/include/diff.bare +2 -6
- package/lib/include/qrcode.bare +2 -2
- package/lib/library.js +18 -0
- package/package.json +5 -3
package/lib/include/args.bare
CHANGED
|
@@ -232,7 +232,7 @@ function argsGlobalName(argument):
|
|
|
232
232
|
global = objectGet(argument, 'global')
|
|
233
233
|
if global == null:
|
|
234
234
|
name = objectGet(argument, 'name')
|
|
235
|
-
global = 'v' + stringUpper(
|
|
235
|
+
global = 'v' + stringUpper(stringCharAt(name, 0)) + stringSlice(name, 1)
|
|
236
236
|
endif
|
|
237
237
|
return global
|
|
238
238
|
endfunction
|
package/lib/include/diff.bare
CHANGED
|
@@ -132,19 +132,15 @@ function diffLinesToArray(input):
|
|
|
132
132
|
if systemType(input) == 'array':
|
|
133
133
|
lines = []
|
|
134
134
|
for part in input:
|
|
135
|
-
arrayExtend(lines,
|
|
135
|
+
arrayExtend(lines, stringSplitLines(part))
|
|
136
136
|
endfor
|
|
137
137
|
return lines
|
|
138
138
|
endif
|
|
139
139
|
|
|
140
140
|
# String input
|
|
141
|
-
lines =
|
|
141
|
+
lines = stringSplitLines(input)
|
|
142
142
|
if arrayLength(lines) == 1 && arrayGet(lines, 0) == '':
|
|
143
143
|
return []
|
|
144
144
|
endif
|
|
145
145
|
return lines
|
|
146
146
|
endfunction
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
# Regex for splitting lines
|
|
150
|
-
diffRegexLineSplit = regexNew('\r?\n')
|
package/lib/include/qrcode.bare
CHANGED
|
@@ -583,8 +583,8 @@ function qrcodeModeAlphanumericBits(message):
|
|
|
583
583
|
messageLengthMinusOne = messageLength - 1
|
|
584
584
|
ixChar = 0
|
|
585
585
|
while ixChar < messageLength:
|
|
586
|
-
value1 = stringIndexOf(qrcodeModeAlphanumericStr,
|
|
587
|
-
value2 = if(ixChar < messageLengthMinusOne, stringIndexOf(qrcodeModeAlphanumericStr,
|
|
586
|
+
value1 = stringIndexOf(qrcodeModeAlphanumericStr, stringCharAt(message, ixChar))
|
|
587
|
+
value2 = if(ixChar < messageLengthMinusOne, stringIndexOf(qrcodeModeAlphanumericStr, stringCharAt(message, ixChar + 1)))
|
|
588
588
|
if value2 == null:
|
|
589
589
|
arrayExtend(messageBits, qrcodeBytesToBits([value1], 6))
|
|
590
590
|
else:
|
package/lib/library.js
CHANGED
|
@@ -1918,6 +1918,23 @@ const stringSplitArgs = valueArgsModel([
|
|
|
1918
1918
|
]);
|
|
1919
1919
|
|
|
1920
1920
|
|
|
1921
|
+
// $function: stringSplitLines
|
|
1922
|
+
// $group: string
|
|
1923
|
+
// $doc: Split a string at line boundaries
|
|
1924
|
+
// $arg string: The string to split
|
|
1925
|
+
// $return: The array of line strings
|
|
1926
|
+
function stringSplitLines(args) {
|
|
1927
|
+
const [string] = valueArgsValidate(stringSplitLinesArgs, args);
|
|
1928
|
+
return string.split(stringSplitLinesRegex);
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
const stringSplitLinesArgs = valueArgsModel([
|
|
1932
|
+
{'name': 'string', 'type': 'string'}
|
|
1933
|
+
]);
|
|
1934
|
+
|
|
1935
|
+
const stringSplitLinesRegex = /\r?\n/;
|
|
1936
|
+
|
|
1937
|
+
|
|
1921
1938
|
// $function: stringStartsWith
|
|
1922
1939
|
// $group: string
|
|
1923
1940
|
// $doc: Determine if a string starts with a search string
|
|
@@ -2366,6 +2383,7 @@ export const scriptFunctions = {
|
|
|
2366
2383
|
stringReplace,
|
|
2367
2384
|
stringSlice,
|
|
2368
2385
|
stringSplit,
|
|
2386
|
+
stringSplitLines,
|
|
2369
2387
|
stringStartsWith,
|
|
2370
2388
|
stringTrim,
|
|
2371
2389
|
stringUpper,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "bare-script",
|
|
4
|
-
"version": "3.8.
|
|
4
|
+
"version": "3.8.19",
|
|
5
5
|
"description": "BareScript; a lightweight scripting and expression language",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"expression",
|
|
@@ -31,8 +31,10 @@
|
|
|
31
31
|
"schema-markdown": "~1.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
34
|
+
"@eslint/js": "~10.0",
|
|
35
|
+
"c8": "~11.0",
|
|
36
|
+
"eslint": "~10.0",
|
|
37
|
+
"globals": "~17.4",
|
|
36
38
|
"jsdoc": "~4.0"
|
|
37
39
|
}
|
|
38
40
|
}
|