@calcit/procs 0.5.35 → 0.5.38

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.
@@ -168,7 +168,7 @@ let defaultHash_record = valueHash("record:");
168
168
  let defaultHash_unknown = valueHash("unknown:");
169
169
  let fnHashCounter = 0;
170
170
  let jsObjectHashCounter = 0;
171
- let hashFunction = (x) => {
171
+ export let hashFunction = (x) => {
172
172
  if (x == null) {
173
173
  return defaultHash_nil;
174
174
  }
@@ -1,11 +1,10 @@
1
1
  var _a;
2
2
  // CALCIT VERSION
3
- export const calcit_version = "0.5.35";
4
- import "@calcit/ternary-tree";
3
+ export const calcit_version = "0.5.38";
5
4
  import { parse } from "@cirru/parser.ts";
6
5
  import { writeCirruCode } from "@cirru/writer.ts";
7
6
  import "./js-primes.mjs";
8
- import { CalcitSymbol, CalcitKeyword, CalcitRef, CalcitRecur, kwd, refsRegistry, toString, getStringName, _$n__$e_, } from "./calcit-data.mjs";
7
+ import { CalcitSymbol, CalcitKeyword, CalcitRef, CalcitRecur, kwd, refsRegistry, toString, getStringName, _$n__$e_, hashFunction, } from "./calcit-data.mjs";
9
8
  import { CalcitRecord } from "./js-record.mjs";
10
9
  export * from "./calcit-data.mjs";
11
10
  export * from "./js-record.mjs";
@@ -849,7 +848,7 @@ export let aget = (x, name) => {
849
848
  export let aset = (x, name, v) => {
850
849
  return (x[name] = v);
851
850
  };
852
- export let get_env = (name) => {
851
+ export let get_env = (name, v0) => {
853
852
  let v = undefined;
854
853
  if (inNodeJs) {
855
854
  // only available for Node.js
@@ -858,10 +857,13 @@ export let get_env = (name) => {
858
857
  else if (typeof URLSearchParams != null && typeof location != null) {
859
858
  v = new URLSearchParams(location.search).get(name);
860
859
  }
861
- if (v == null) {
862
- console.warn(`(get-env "${name}"): ${v}`);
860
+ if (v != null && v0 != null) {
861
+ console.log(`(get-env ${name}): ${v}`);
863
862
  }
864
- return v;
863
+ if (v == null && v0 == null) {
864
+ console.warn(`(get-env "${name}"): config not found`);
865
+ }
866
+ return v !== null && v !== void 0 ? v : v0;
865
867
  };
866
868
  export let turn_keyword = (x) => {
867
869
  if (typeof x === "string") {
@@ -1289,6 +1291,9 @@ export let _$n_buffer = (...xs) => {
1289
1291
  }
1290
1292
  return buf;
1291
1293
  };
1294
+ export let _$n_hash = (x) => {
1295
+ return hashFunction(x);
1296
+ };
1292
1297
  // special procs have to be defined manually
1293
1298
  export let reduce = foldl;
1294
1299
  let unavailableProc = (...xs) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.5.35",
3
+ "version": "0.5.38",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^17.0.23",
@@ -198,7 +198,7 @@ let defaultHash_unknown = valueHash("unknown:");
198
198
  let fnHashCounter = 0;
199
199
  let jsObjectHashCounter = 0;
200
200
 
201
- let hashFunction = (x: CalcitValue): Hash => {
201
+ export let hashFunction = (x: CalcitValue): Hash => {
202
202
  if (x == null) {
203
203
  return defaultHash_nil;
204
204
  }
@@ -1,7 +1,6 @@
1
1
  // CALCIT VERSION
2
- export const calcit_version = "0.5.35";
2
+ export const calcit_version = "0.5.38";
3
3
 
4
- import { overwriteComparator, initTernaryTreeMap } from "@calcit/ternary-tree";
5
4
  import { parse, ICirruNode } from "@cirru/parser.ts";
6
5
  import { writeCirruCode } from "@cirru/writer.ts";
7
6
 
@@ -18,6 +17,7 @@ import {
18
17
  getStringName,
19
18
  to_js_data,
20
19
  _$n__$e_,
20
+ hashFunction,
21
21
  } from "./calcit-data.mjs";
22
22
 
23
23
  import { fieldsEqual, CalcitRecord } from "./js-record.mjs";
@@ -935,7 +935,7 @@ export let aset = (x: any, name: string, v: any): any => {
935
935
  return (x[name] = v);
936
936
  };
937
937
 
938
- export let get_env = (name: string): string => {
938
+ export let get_env = (name: string, v0: string): string => {
939
939
  let v = undefined;
940
940
  if (inNodeJs) {
941
941
  // only available for Node.js
@@ -943,10 +943,13 @@ export let get_env = (name: string): string => {
943
943
  } else if (typeof URLSearchParams != null && typeof location != null) {
944
944
  v = new URLSearchParams(location.search).get(name);
945
945
  }
946
- if (v == null) {
947
- console.warn(`(get-env "${name}"): ${v}`);
946
+ if (v != null && v0 != null) {
947
+ console.log(`(get-env ${name}): ${v}`);
948
948
  }
949
- return v;
949
+ if (v == null && v0 == null) {
950
+ console.warn(`(get-env "${name}"): config not found`);
951
+ }
952
+ return v ?? v0;
950
953
  };
951
954
 
952
955
  export let turn_keyword = (x: CalcitValue): CalcitKeyword => {
@@ -1382,6 +1385,10 @@ export let _$n_buffer = (...xs: CalcitValue[]): Uint8Array => {
1382
1385
  return buf;
1383
1386
  };
1384
1387
 
1388
+ export let _$n_hash = (x: CalcitValue): number => {
1389
+ return hashFunction(x);
1390
+ };
1391
+
1385
1392
  // special procs have to be defined manually
1386
1393
  export let reduce = foldl;
1387
1394