@hestia-earth/utils 0.16.6 → 0.16.9

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/dist/array.js CHANGED
@@ -15,10 +15,14 @@ var __read = (this && this.__read) || function (o, n) {
15
15
  }
16
16
  return ar;
17
17
  };
18
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
19
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
20
- to[j] = from[i];
21
- return to;
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
22
26
  };
23
27
  Object.defineProperty(exports, "__esModule", { value: true });
24
28
  exports.isEqual = exports.intersection = exports.unique = void 0;
@@ -29,8 +33,8 @@ exports.isEqual = exports.intersection = exports.unique = void 0;
29
33
  */
30
34
  var unique = function (values) {
31
35
  return values.some(function (v) { return typeof v === 'object'; })
32
- ? __spreadArray([], __read(new Set(values.map(function (v) { return JSON.stringify(v); })))).map(function (v) { return JSON.parse(v); })
33
- : __spreadArray([], __read(new Set(values)));
36
+ ? __spreadArray([], __read(new Set(values.map(function (v) { return JSON.stringify(v); }))), false).map(function (v) { return JSON.parse(v); })
37
+ : __spreadArray([], __read(new Set(values)), false);
34
38
  };
35
39
  exports.unique = unique;
36
40
  /**
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  /* eslint-disable no-console */
5
5
  var validate_terms_1 = require("../validate-terms");
6
- validate_terms_1.run()
6
+ (0, validate_terms_1.run)()
7
7
  .then(function (paths) {
8
8
  console.log('Done validating', paths.length, 'files.');
9
9
  console.log(paths.join('\n'));
package/dist/boolean.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isBoolean = void 0;
4
4
  var isBoolean = function (value) {
5
- return typeof value === 'boolean' || ("" + value).toLowerCase() === 'true' || ("" + value).toLowerCase() === 'false';
5
+ return typeof value === 'boolean' || "".concat(value).toLowerCase() === 'true' || "".concat(value).toLowerCase() === 'false';
6
6
  };
7
7
  exports.isBoolean = isBoolean;
package/dist/date.js CHANGED
@@ -27,7 +27,7 @@ exports.diffInDays = diffInDays;
27
27
  * @returns The difference between date1 and date2 in years (precision: 1).
28
28
  */
29
29
  var diffInYears = function (date1, date2) {
30
- return Math.round((exports.diffInDays(date1, date2) / year) * 10) / 10;
30
+ return Math.round(((0, exports.diffInDays)(date1, date2) / year) * 10) / 10;
31
31
  };
32
32
  exports.diffInYears = diffInYears;
33
33
  /**
package/dist/delta.d.ts CHANGED
@@ -2,7 +2,7 @@ export declare enum DeltaDisplayType {
2
2
  absolute = "absolute",
3
3
  percent = "percent"
4
4
  }
5
- declare type deltaTypeMapping = {
5
+ type deltaTypeMapping = {
6
6
  [type in DeltaDisplayType]?: (value: number, original: number) => number;
7
7
  };
8
8
  export declare const customDeltaFuncs: {
package/dist/delta.js CHANGED
@@ -18,12 +18,12 @@ var DeltaDisplayType;
18
18
  (function (DeltaDisplayType) {
19
19
  DeltaDisplayType["absolute"] = "absolute";
20
20
  DeltaDisplayType["percent"] = "percent";
21
- })(DeltaDisplayType = exports.DeltaDisplayType || (exports.DeltaDisplayType = {}));
21
+ })(DeltaDisplayType || (exports.DeltaDisplayType = DeltaDisplayType = {}));
22
22
  var deltaPerType = (_a = {},
23
23
  _a[DeltaDisplayType.absolute] = function (value, original) { return value - original; },
24
24
  _a[DeltaDisplayType.percent] = function (value, original) { return ((value - original) / original) * 100; },
25
25
  _a);
26
- var roundValue = function (value) { return +("" + value).substring(0, 10); };
26
+ var roundValue = function (value) { return +"".concat(value).substring(0, 10); };
27
27
  var PercentDeltaConditions;
28
28
  (function (PercentDeltaConditions) {
29
29
  PercentDeltaConditions["recalculated0"] = "recalculated should be 0";
@@ -60,8 +60,8 @@ exports.customDeltaFuncs = (_d = {},
60
60
  */
61
61
  var delta = function (value, originalValue, displayType, mapping, termId) {
62
62
  if (displayType === void 0) { displayType = DeltaDisplayType.percent; }
63
- var vvalue = roundValue(term_1.propertyValue(value, termId));
64
- var voriginalValue = roundValue(term_1.propertyValue(originalValue, termId));
63
+ var vvalue = roundValue((0, term_1.propertyValue)(value, termId));
64
+ var voriginalValue = roundValue((0, term_1.propertyValue)(originalValue, termId));
65
65
  var deltaFuncs = __assign(__assign({}, deltaPerType), mapping);
66
66
  var diff = vvalue === voriginalValue ? 0 : deltaFuncs[displayType](vvalue, voriginalValue);
67
67
  return Number.isFinite(diff) ? (diff === -0 ? 0 : diff) : 0;
package/dist/form.js CHANGED
@@ -16,7 +16,7 @@ var utils_1 = require("./utils");
16
16
  var filterParams = function (obj) {
17
17
  return Object.keys(obj).reduce(function (prev, key) {
18
18
  var _a;
19
- return (__assign(__assign({}, prev), (utils_1.isUndefined(obj[key]) || obj[key] === '' ? {} : (_a = {}, _a[key] = "" + obj[key], _a))));
19
+ return (__assign(__assign({}, prev), ((0, utils_1.isUndefined)(obj[key]) || obj[key] === '' ? {} : (_a = {}, _a[key] = "".concat(obj[key]), _a))));
20
20
  }, {});
21
21
  };
22
22
  exports.filterParams = filterParams;
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/number.d.ts CHANGED
@@ -13,6 +13,14 @@ export declare const isNumber: (n: string | number) => boolean;
13
13
  * @param precision The number of significant figures
14
14
  */
15
15
  export declare const toPrecision: (n: number, precision?: number) => number;
16
+ /**
17
+ * Get the value of an array for a given percentile.
18
+ *
19
+ * @param values
20
+ * @param percentile
21
+ * @returns
22
+ */
23
+ export declare const getPercentileValue: (values: number[], percentile: number) => number;
16
24
  /**
17
25
  * Returns the number formatted with commas every thousand.
18
26
  *
package/dist/number.js CHANGED
@@ -17,7 +17,7 @@ var __read = (this && this.__read) || function (o, n) {
17
17
  };
18
18
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.median = exports.max = exports.min = exports.mean = exports.sum = exports.convertValue = exports.converters = exports.ConvertUnits = exports.toComma = exports.toPrecision = exports.isNumber = void 0;
20
+ exports.median = exports.max = exports.min = exports.mean = exports.sum = exports.convertValue = exports.converters = exports.ConvertUnits = exports.toComma = exports.getPercentileValue = exports.toPrecision = exports.isNumber = void 0;
21
21
  /**
22
22
  * Check if the value is a number.
23
23
  *
@@ -26,7 +26,7 @@ exports.median = exports.max = exports.min = exports.mean = exports.sum = export
26
26
  */
27
27
  var isNumber = function (n) {
28
28
  var _a;
29
- return [(_a = /^(-)?[\d\.]+((e|e-)[\d]+)?$/.exec("" + n)) === null || _a === void 0 ? void 0 : _a.length, !isNaN(parseFloat("" + n)), isFinite(parseFloat("" + n))].every(Boolean);
29
+ return [(_a = /^(-)?[\d\.]+((e|e-)[\d]+)?$/.exec("".concat(n))) === null || _a === void 0 ? void 0 : _a.length, !isNaN(parseFloat("".concat(n))), isFinite(parseFloat("".concat(n)))].every(Boolean);
30
30
  };
31
31
  exports.isNumber = isNumber;
32
32
  /**
@@ -41,12 +41,28 @@ var toPrecision = function (n, precision) {
41
41
  var mult = Math.pow(10, precision - Math.floor(Math.log(n < 0 ? -n : n) / Math.LN10) - 1);
42
42
  var multiplier = Math.max(
43
43
  // handle floating errors like 0.00009999999999999999
44
- +("" + mult).replace(/[0]([1-9])\1+/g, function (v) { return "" + (+v.substring(0, 1) + 1); }),
44
+ +"".concat(mult).replace(/[0]([1-9])\1+/g, function (v) { return "".concat(+v.substring(0, 1) + 1); }),
45
45
  // dividing by 0.00001 will give floating point error
46
46
  0.0001);
47
47
  return n === 0 ? 0 : Math.round(n * multiplier) / multiplier;
48
48
  };
49
49
  exports.toPrecision = toPrecision;
50
+ /**
51
+ * Get the value of an array for a given percentile.
52
+ *
53
+ * @param values
54
+ * @param percentile
55
+ * @returns
56
+ */
57
+ var getPercentileValue = function (values, percentile) {
58
+ var sorted = values.slice().sort(function (a, b) { return a - b; });
59
+ var index = (sorted.length - 1) * percentile;
60
+ var lower = Math.floor(index);
61
+ var upper = Math.ceil(index);
62
+ var weight = index - lower;
63
+ return lower === upper ? sorted[index] : sorted[lower] * (1 - weight) + sorted[upper] * weight;
64
+ };
65
+ exports.getPercentileValue = getPercentileValue;
50
66
  /**
51
67
  * Returns the number formatted with commas every thousand.
52
68
  *
@@ -55,7 +71,7 @@ exports.toPrecision = toPrecision;
55
71
  var toComma = function (n) {
56
72
  var _a = __read(n.toString().split('.'), 2), numberPart = _a[0], decimalPart = _a[1];
57
73
  var thousands = /\B(?=(\d{3})+(?!\d))/g;
58
- return "" + numberPart.replace(thousands, ',') + (decimalPart ? "." + decimalPart : '');
74
+ return "".concat(numberPart.replace(thousands, ',')).concat(decimalPart ? ".".concat(decimalPart) : '');
59
75
  };
60
76
  exports.toComma = toComma;
61
77
  var C = 12.012;
@@ -101,7 +117,7 @@ var ConvertUnits;
101
117
  ConvertUnits["kgP"] = "kg P";
102
118
  ConvertUnits["kgP2O5"] = "kg P2O5";
103
119
  ConvertUnits["kgPO43"] = "kg PO43";
104
- })(ConvertUnits = exports.ConvertUnits || (exports.ConvertUnits = {}));
120
+ })(ConvertUnits || (exports.ConvertUnits = ConvertUnits = {}));
105
121
  exports.converters = (_a = {},
106
122
  _a[ConvertUnits.m3] = (_b = {},
107
123
  _b[ConvertUnits.kg] = function (value, args) { return value * args.density; },
@@ -198,7 +214,7 @@ var sum = function (values) {
198
214
  exports.sum = sum;
199
215
  var mean = function (values) {
200
216
  if (values === void 0) { values = []; }
201
- return ((values === null || values === void 0 ? void 0 : values.length) ? exports.sum(values) / values.length : 0);
217
+ return ((values === null || values === void 0 ? void 0 : values.length) ? (0, exports.sum)(values) / values.length : 0);
202
218
  };
203
219
  exports.mean = mean;
204
220
  var min = function (values) { return Math.min.apply(Math.min, values); };
package/dist/string.js CHANGED
@@ -27,14 +27,14 @@ exports.parseCitation = exports.parseMarkdownLink = exports.now = exports.toCame
27
27
  var ellipsis = function (text, maxlength) {
28
28
  if (text === void 0) { text = ''; }
29
29
  if (maxlength === void 0) { maxlength = 20; }
30
- return text.length > maxlength ? text.substring(0, maxlength) + "..." : text;
30
+ return text.length > maxlength ? "".concat(text.substring(0, maxlength), "...") : text;
31
31
  };
32
32
  exports.ellipsis = ellipsis;
33
33
  var keyToLabel = function (key) {
34
- return "" + key[0].toUpperCase() + key
34
+ return "".concat(key[0].toUpperCase()).concat(key
35
35
  .replace(/([a-z])([A-Z])/g, '$1 $2')
36
- .replace(/([_])([a-zA-Z])/g, function (g) { return " " + g[1].toUpperCase(); })
37
- .substring(1);
36
+ .replace(/([_])([a-zA-Z])/g, function (g) { return " ".concat(g[1].toUpperCase()); })
37
+ .substring(1));
38
38
  };
39
39
  exports.keyToLabel = keyToLabel;
40
40
  /**
@@ -47,7 +47,7 @@ var toDashCase = function (value) {
47
47
  return value
48
48
  ? value
49
49
  // handle dates followed by capital letter
50
- .replace(/([\d]{4})([A-Z]{1})/g, function (g) { return g.substring(0, 4) + "-" + g[4].toLowerCase(); })
50
+ .replace(/([\d]{4})([A-Z]{1})/g, function (g) { return "".concat(g.substring(0, 4), "-").concat(g[4].toLowerCase()); })
51
51
  // handle words followed by dates
52
52
  .replace(/([A-Za-z]{1})([\d]{4})/g, '$1-$2')
53
53
  // handle molecules
@@ -56,12 +56,12 @@ var toDashCase = function (value) {
56
56
  for (var _i = 1; _i < arguments.length; _i++) {
57
57
  args[_i - 1] = arguments[_i];
58
58
  }
59
- return (args[0] + "-" + args[1]).toLowerCase();
59
+ return "".concat(args[0], "-").concat(args[1]).toLowerCase();
60
60
  })
61
61
  // handle words followed by numbers
62
62
  .replace(/([A-Z][a-z]+)([0-9]{2,})/g, '$1-$2')
63
63
  // handle all capital letters
64
- .replace(/([A-Z])/g, function (g) { return "-" + g[0].toLowerCase(); })
64
+ .replace(/([A-Z])/g, function (g) { return "-".concat(g[0].toLowerCase()); })
65
65
  // handle underscores
66
66
  .replace(/[\_\.]/g, '-')
67
67
  : null;
@@ -114,7 +114,7 @@ exports.parseMarkdownLink = parseMarkdownLink;
114
114
  */
115
115
  var parseCitation = function (value) {
116
116
  var _a, _b;
117
- var parsed = exports.parseMarkdownLink(value);
117
+ var parsed = (0, exports.parseMarkdownLink)(value);
118
118
  var _c = __read(parsed.title.match(/(.*[(]\d+[)][\.|\s])?(.*)/), 3), original = _c[0], name = _c[1], title = _c[2];
119
119
  return {
120
120
  original: original,
package/dist/term.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare type propertyValueType = string | number | boolean | null;
1
+ export type propertyValueType = string | number | boolean | null;
2
2
  export declare const arrayValue: (values?: propertyValueType[], isAverage?: boolean) => string | number | boolean;
3
3
  /**
4
4
  * Calculate the final value of a property.
package/dist/term.js CHANGED
@@ -8,13 +8,13 @@ var boolean_1 = require("./boolean");
8
8
  var arrayValue = function (values, isAverage) {
9
9
  if (values === void 0) { values = []; }
10
10
  if (isAverage === void 0) { isAverage = false; }
11
- var filteredValues = values.filter(function (v) { return !utils_1.isEmpty(v); });
11
+ var filteredValues = values.filter(function (v) { return !(0, utils_1.isEmpty)(v); });
12
12
  return filteredValues.length === 0
13
13
  ? null
14
14
  : filteredValues.every(number_1.isNumber)
15
15
  ? filteredValues
16
16
  .filter(function (v) { return typeof v !== 'undefined'; })
17
- .reduce(function (prev, curr) { return prev + parseFloat("" + curr); }, 0) / (isAverage ? filteredValues.length : 1)
17
+ .reduce(function (prev, curr) { return prev + parseFloat("".concat(curr)); }, 0) / (isAverage ? filteredValues.length : 1)
18
18
  : filteredValues.every(boolean_1.isBoolean)
19
19
  ? filteredValues.every(Boolean)
20
20
  : filteredValues.join(';');
@@ -27,12 +27,12 @@ exports.arrayValue = arrayValue;
27
27
  * @param termId Optional - us if the term should handle an array in a specific way.
28
28
  */
29
29
  var propertyValue = function (value, termId) {
30
- return utils_1.isUndefined(value)
30
+ return (0, utils_1.isUndefined)(value)
31
31
  ? null
32
32
  : Array.isArray(value)
33
- ? exports.arrayValue(value, (termId ? glossary_1.getArrayTreatment(termId) : null) === 'mean')
34
- : number_1.isNumber(value)
35
- ? parseFloat("" + value)
33
+ ? (0, exports.arrayValue)(value, (termId ? (0, glossary_1.getArrayTreatment)(termId) : null) === 'mean')
34
+ : (0, number_1.isNumber)(value)
35
+ ? parseFloat("".concat(value))
36
36
  : value;
37
37
  };
38
38
  exports.propertyValue = propertyValue;
@@ -43,6 +43,6 @@ exports.propertyValue = propertyValue;
43
43
  * @returns
44
44
  */
45
45
  var emptyValue = function (value, termId) {
46
- return utils_1.isEmpty(value) || isNaN(exports.propertyValue(value, termId));
46
+ return (0, utils_1.isEmpty)(value) || isNaN((0, exports.propertyValue)(value, termId));
47
47
  };
48
48
  exports.emptyValue = emptyValue;
package/dist/utils.js CHANGED
@@ -55,12 +55,12 @@ var reduceUndefinedValues = function (obj, allowNull) {
55
55
  return Object.entries(obj).reduce(function (prev, _a) {
56
56
  var _b;
57
57
  var _c = __read(_a, 2), key = _c[0], value = _c[1];
58
- return __assign(__assign({}, prev), (exports.isUndefined(value, allowNull) ? {} : (_b = {}, _b[key] = value, _b)));
58
+ return __assign(__assign({}, prev), ((0, exports.isUndefined)(value, allowNull) ? {} : (_b = {}, _b[key] = value, _b)));
59
59
  }, {});
60
60
  };
61
61
  exports.reduceUndefinedValues = reduceUndefinedValues;
62
62
  var filterUndefinedValues = function (values, allowNull) {
63
63
  if (allowNull === void 0) { allowNull = false; }
64
- return values.filter(function (value) { return !exports.isUndefined(value, allowNull); });
64
+ return values.filter(function (value) { return !(0, exports.isUndefined)(value, allowNull); });
65
65
  };
66
66
  exports.filterUndefinedValues = filterUndefinedValues;
@@ -8,6 +8,6 @@ declare class Term {
8
8
  * @param terms The list of Terms to validate.
9
9
  * @returns The list of ids/names that could not be found (invalid).
10
10
  */
11
- export declare const validateTerms: (terms: Term[]) => Promise<(string | true)[]>;
11
+ export declare const validateTerms: (terms: Term[]) => Promise<string[]>;
12
12
  export declare const run: () => Promise<string[]>;
13
13
  export {};
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -51,10 +51,14 @@ var __read = (this && this.__read) || function (o, n) {
51
51
  }
52
52
  return ar;
53
53
  };
54
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
55
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
56
- to[j] = from[i];
57
- return to;
54
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
55
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
56
+ if (ar || !(i in from)) {
57
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
58
+ ar[i] = from[i];
59
+ }
60
+ }
61
+ return to.concat(ar || Array.prototype.slice.call(from));
58
62
  };
59
63
  Object.defineProperty(exports, "__esModule", { value: true });
60
64
  exports.run = exports.validateTerms = void 0;
@@ -73,7 +77,7 @@ var Term = /** @class */ (function () {
73
77
  }());
74
78
  var search = function (body) {
75
79
  return new Promise(function (resolve, reject) {
76
- var req = https_1.request(API_URL + "/search", {
80
+ var req = (0, https_1.request)("".concat(API_URL, "/search"), {
77
81
  method: 'POST',
78
82
  headers: { 'Content-Type': 'application/json' }
79
83
  }, function (res) {
@@ -98,16 +102,16 @@ var recursiveFiles = function (directory) { return __awaiter(void 0, void 0, voi
98
102
  var _a;
99
103
  return __generator(this, function (_b) {
100
104
  switch (_b.label) {
101
- case 0: return [4 /*yield*/, lstat(path_1.join(directory, entry))];
105
+ case 0: return [4 /*yield*/, lstat((0, path_1.join)(directory, entry))];
102
106
  case 1:
103
107
  if (!(_b.sent()).isDirectory()) return [3 /*break*/, 3];
104
- return [4 /*yield*/, recursiveFiles(path_1.join(directory, entry))];
108
+ return [4 /*yield*/, recursiveFiles((0, path_1.join)(directory, entry))];
105
109
  case 2:
106
110
  _a = _b.sent();
107
111
  return [3 /*break*/, 4];
108
112
  case 3:
109
- _a = path_1.join(directory, entry).endsWith("." + (extension || 'jsonld'))
110
- ? [path_1.join(directory, entry)]
113
+ _a = (0, path_1.join)(directory, entry).endsWith(".".concat(extension || 'jsonld'))
114
+ ? [(0, path_1.join)(directory, entry)]
111
115
  : [];
112
116
  _b.label = 4;
113
117
  case 4: return [2 /*return*/, _a];
@@ -165,7 +169,7 @@ var searchTerms = function (terms) { return __awaiter(void 0, void 0, void 0, fu
165
169
  _d.label = 3;
166
170
  case 3:
167
171
  results = (_a).results;
168
- _b = [__spreadArray([], __read(results))];
172
+ _b = [__spreadArray([], __read(results), false)];
169
173
  if (!(terms.length > searchLimit)) return [3 /*break*/, 5];
170
174
  return [4 /*yield*/, searchTerms(terms.slice(searchLimit))];
171
175
  case 4:
@@ -174,7 +178,7 @@ var searchTerms = function (terms) { return __awaiter(void 0, void 0, void 0, fu
174
178
  case 5:
175
179
  _c = [];
176
180
  _d.label = 6;
177
- case 6: return [2 /*return*/, __spreadArray.apply(void 0, _b.concat([__read.apply(void 0, [(_c)])]))];
181
+ case 6: return [2 /*return*/, __spreadArray.apply(void 0, _b.concat([__read.apply(void 0, [(_c)]), false]))];
178
182
  }
179
183
  });
180
184
  }); };
@@ -243,7 +247,7 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
243
247
  return [4 /*yield*/, Promise.all(filepaths.map(loadFile))];
244
248
  case 2:
245
249
  fileData = _a.sent();
246
- allTerms = array_1.unique(fileData.flatMap(function (_a) {
250
+ allTerms = (0, array_1.unique)(fileData.flatMap(function (_a) {
247
251
  var terms = _a.terms;
248
252
  return terms;
249
253
  }));
@@ -256,10 +260,10 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
256
260
  return missing.length;
257
261
  });
258
262
  if (missingFiles.length) {
259
- throw new Error(("\n Terms not found:\n \t" + missingFiles.map(function (_a) {
263
+ throw new Error("\n Terms not found:\n \t".concat(missingFiles.map(function (_a) {
260
264
  var filepath = _a.filepath, missing = _a.missing;
261
- return "- " + filepath + ": " + missing.join(', ');
262
- }).join('\n\t') + "\n ").trim());
265
+ return "- ".concat(filepath, ": ").concat(missing.join(', '));
266
+ }).join('\n\t'), "\n ").trim());
263
267
  }
264
268
  return [2 /*return*/, filepaths];
265
269
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/utils",
3
- "version": "0.16.6",
3
+ "version": "0.16.9",
4
4
  "description": "HESTIA Utils library",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  "@hestia-earth/glossary": "^0.44.0",
37
37
  "@types/chai": "^4.2.21",
38
38
  "@types/mocha": "^7.0.2",
39
- "@types/node": "^16.18.59",
39
+ "@types/node": "^22.18.11",
40
40
  "@types/sinon": "^9.0.11",
41
41
  "@typescript-eslint/eslint-plugin": "^5.27.1",
42
42
  "@typescript-eslint/parser": "^5.27.1",
@@ -48,7 +48,7 @@
48
48
  "sinon": "^9.2.4",
49
49
  "source-map-support": "^0.5.19",
50
50
  "ts-node": "^9.1.1",
51
- "typescript": "^4.3.5"
51
+ "typescript": "^5.9.3"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@hestia-earth/glossary": ">=0.8.0"