bare-script 3.8.17 → 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/markdownUp.bare +1 -0
- package/lib/include/qrcode.bare +2 -2
- package/lib/library.js +28 -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')
|
|
@@ -595,6 +595,7 @@ endfunction
|
|
|
595
595
|
# $group: markdownUp.bare: window
|
|
596
596
|
# $doc: Write text to the clipboard
|
|
597
597
|
# $arg text: The text to write
|
|
598
|
+
# $arg type: The clipboard content type (default is "text/plain")
|
|
598
599
|
function windowClipboardWrite(text):
|
|
599
600
|
return objectSet(markdownUpState, 'windowClipboard', text)
|
|
600
601
|
endfunction
|
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
|
@@ -950,6 +950,15 @@ const mathCosArgs = valueArgsModel([
|
|
|
950
950
|
]);
|
|
951
951
|
|
|
952
952
|
|
|
953
|
+
// $function: mathE
|
|
954
|
+
// $group: math
|
|
955
|
+
// $doc: Return Euler's number
|
|
956
|
+
// $return: Euler's number
|
|
957
|
+
function mathE() {
|
|
958
|
+
return Math.E;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
|
|
953
962
|
// $function: mathFloor
|
|
954
963
|
// $group: math
|
|
955
964
|
// $doc: Compute the floor of a number (round down to the next lowest integer)
|
|
@@ -1909,6 +1918,23 @@ const stringSplitArgs = valueArgsModel([
|
|
|
1909
1918
|
]);
|
|
1910
1919
|
|
|
1911
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
|
+
|
|
1912
1938
|
// $function: stringStartsWith
|
|
1913
1939
|
// $group: string
|
|
1914
1940
|
// $doc: Determine if a string starts with a search string
|
|
@@ -2306,6 +2332,7 @@ export const scriptFunctions = {
|
|
|
2306
2332
|
mathAtan2,
|
|
2307
2333
|
mathCeil,
|
|
2308
2334
|
mathCos,
|
|
2335
|
+
mathE,
|
|
2309
2336
|
mathFloor,
|
|
2310
2337
|
mathLn,
|
|
2311
2338
|
mathLog,
|
|
@@ -2356,6 +2383,7 @@ export const scriptFunctions = {
|
|
|
2356
2383
|
stringReplace,
|
|
2357
2384
|
stringSlice,
|
|
2358
2385
|
stringSplit,
|
|
2386
|
+
stringSplitLines,
|
|
2359
2387
|
stringStartsWith,
|
|
2360
2388
|
stringTrim,
|
|
2361
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
|
}
|