@calcit/procs 0.5.37 → 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.
@@ -1,6 +1,6 @@
1
1
  var _a;
2
2
  // CALCIT VERSION
3
- export const calcit_version = "0.5.37";
3
+ export const calcit_version = "0.5.38";
4
4
  import { parse } from "@cirru/parser.ts";
5
5
  import { writeCirruCode } from "@cirru/writer.ts";
6
6
  import "./js-primes.mjs";
@@ -848,7 +848,7 @@ export let aget = (x, name) => {
848
848
  export let aset = (x, name, v) => {
849
849
  return (x[name] = v);
850
850
  };
851
- export let get_env = (name) => {
851
+ export let get_env = (name, v0) => {
852
852
  let v = undefined;
853
853
  if (inNodeJs) {
854
854
  // only available for Node.js
@@ -857,10 +857,13 @@ export let get_env = (name) => {
857
857
  else if (typeof URLSearchParams != null && typeof location != null) {
858
858
  v = new URLSearchParams(location.search).get(name);
859
859
  }
860
- if (v == null) {
861
- console.warn(`(get-env "${name}"): ${v}`);
860
+ if (v != null && v0 != null) {
861
+ console.log(`(get-env ${name}): ${v}`);
862
862
  }
863
- 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;
864
867
  };
865
868
  export let turn_keyword = (x) => {
866
869
  if (typeof x === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.5.37",
3
+ "version": "0.5.38",
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.37";
2
+ export const calcit_version = "0.5.38";
3
3
 
4
4
  import { parse, ICirruNode } from "@cirru/parser.ts";
5
5
  import { writeCirruCode } from "@cirru/writer.ts";
@@ -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 => {