@calcit/procs 0.5.31 → 0.5.32

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.
@@ -1,6 +1,6 @@
1
1
  var _a;
2
2
  // CALCIT VERSION
3
- export const calcit_version = "0.5.31";
3
+ export const calcit_version = "0.5.32";
4
4
  import "@calcit/ternary-tree";
5
5
  import { parse } from "@cirru/parser.ts";
6
6
  import { writeCirruCode } from "@cirru/writer.ts";
@@ -1273,6 +1273,22 @@ export let _$n_str_$o_pad_right = (s, size, pattern) => {
1273
1273
  export let _$n_get_os = () => {
1274
1274
  return kwd("js-engine");
1275
1275
  };
1276
+ export let _$n_buffer = (...xs) => {
1277
+ let buf = new Uint8Array(xs.length);
1278
+ for (let idx = 0; idx < xs.length; idx++) {
1279
+ let x = xs[idx];
1280
+ if (typeof x === "number") {
1281
+ buf[idx] = x;
1282
+ }
1283
+ else if (typeof x === "string") {
1284
+ buf[idx] = parseInt(x, 16);
1285
+ }
1286
+ else {
1287
+ throw new Error("invalid value for buffer");
1288
+ }
1289
+ }
1290
+ return buf;
1291
+ };
1276
1292
  // special procs have to be defined manually
1277
1293
  export let reduce = foldl;
1278
1294
  let unavailableProc = (...xs) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.5.31",
3
+ "version": "0.5.32",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^17.0.23",
@@ -1,5 +1,5 @@
1
1
  // CALCIT VERSION
2
- export const calcit_version = "0.5.31";
2
+ export const calcit_version = "0.5.32";
3
3
 
4
4
  import { overwriteComparator, initTernaryTreeMap } from "@calcit/ternary-tree";
5
5
  import { parse, ICirruNode } from "@cirru/parser.ts";
@@ -1365,6 +1365,23 @@ export let _$n_get_os = (): CalcitKeyword => {
1365
1365
  return kwd("js-engine");
1366
1366
  };
1367
1367
 
1368
+ export let _$n_buffer = (...xs: CalcitValue[]): Uint8Array => {
1369
+ let buf = new Uint8Array(xs.length);
1370
+
1371
+ for (let idx = 0; idx < xs.length; idx++) {
1372
+ let x = xs[idx];
1373
+ if (typeof x === "number") {
1374
+ buf[idx] = x;
1375
+ } else if (typeof x === "string") {
1376
+ buf[idx] = parseInt(x, 16);
1377
+ } else {
1378
+ throw new Error("invalid value for buffer");
1379
+ }
1380
+ }
1381
+
1382
+ return buf;
1383
+ };
1384
+
1368
1385
  // special procs have to be defined manually
1369
1386
  export let reduce = foldl;
1370
1387