@lowdefy/helpers 4.0.0-rc.9 → 4.0.1

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/LRUCache.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ let LRUCache = class LRUCache {
38
38
  first() {
39
39
  return this.cache.keys().next().value;
40
40
  }
41
- constructor({ maxSize =100 } = {}){
41
+ constructor({ maxSize = 100 } = {}){
42
42
  this.maxSize = maxSize;
43
43
  this.cache = new Map();
44
44
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -12,7 +12,7 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ function createCachedPromises({ getter , cache }) {
15
+ */ function createCachedPromises({ getter, cache }) {
16
16
  function cachedPromises(key) {
17
17
  const cached = cache.get(key);
18
18
  if (cached) {
package/dist/get.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-param-reassign */ /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/omit.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-param-reassign */ /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/set.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-plusplus */ /* eslint-disable no-use-before-define */ /* eslint-disable no-param-reassign */ /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ function set(target, path, value, options) {
56
56
  if (!type.isArray(path) && !type.isString(path)) {
57
57
  return target;
58
58
  }
59
- let { merge } = opts;
59
+ let { merge } = opts;
60
60
  if (merge && typeof merge !== 'function') {
61
61
  merge = Object.assign;
62
62
  }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-continue */ /* eslint-disable no-plusplus */ /* eslint-disable consistent-return */ /* eslint-disable no-param-reassign */ /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -59,7 +59,7 @@ function stableStringify(obj, opts) {
59
59
  return function stringify(parent, key, node, level) {
60
60
  const indent = space ? `\n${new Array(level + 1).join(space)}` : '';
61
61
  const colonSeparator = space ? ': ' : ':';
62
- if (node && node.toJSON && typeof node.toJSON === 'function') {
62
+ if (node?.toJSON && typeof node.toJSON === 'function') {
63
63
  node = node.toJSON();
64
64
  }
65
65
  node = replacer.call(parent, key, node);
@@ -81,17 +81,17 @@ function stableStringify(obj, opts) {
81
81
  if (cycles) return JSON.stringify('__cycle__');
82
82
  throw new TypeError('Converting circular structure to JSON');
83
83
  } else seen.push(node);
84
- const keys = Object.keys(node).sort(cmp && cmp(node));
85
- const out1 = [];
86
- for(let i1 = 0; i1 < keys.length; i1++){
87
- const ky = keys[i1];
84
+ const keys = Object.keys(node).sort(cmp?.(node));
85
+ const out = [];
86
+ for(let i = 0; i < keys.length; i++){
87
+ const ky = keys[i];
88
88
  const value = stringify(node, ky, node[ky], level + 1);
89
89
  if (!value) continue;
90
90
  const keyValue = JSON.stringify(ky) + colonSeparator + value;
91
- out1.push(indent + space + keyValue);
91
+ out.push(indent + space + keyValue);
92
92
  }
93
93
  seen.splice(seen.indexOf(node), 1);
94
- return `{${out1.join(',')}${indent}}`;
94
+ return `{${out.join(',')}${indent}}`;
95
95
  }({
96
96
  '': obj
97
97
  }, '', obj, 0);
package/dist/swap.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/type.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable indent */ /* eslint-disable default-case */ /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
15
15
  */ // Derived from source:
16
16
  // because both js typeof and instance of sucks! use this.
17
17
  // https://ultimatecourses.com/blog/understanding-javascript-types-and-reliable-type-checking
18
- const { toString } = Object.prototype;
18
+ const { toString } = Object.prototype;
19
19
  function ctorName(val) {
20
20
  return val.constructor ? val.constructor.name : null;
21
21
  }
package/dist/unset.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-param-reassign */ /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/urlQuery.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -12,18 +12,16 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ // TODO: do we want this query-string dep in helpers?
16
- import queryString from 'query-string';
17
- import serializer from './serializer.js';
15
+ */ import serializer from './serializer.js';
18
16
  import type from './type.js';
19
17
  const parse = (str)=>{
20
- const parsed = queryString.parse(str);
18
+ const parsed = new URLSearchParams(str);
21
19
  const deserialized = {};
22
- Object.keys(parsed).forEach((key)=>{
20
+ parsed.forEach((value, key)=>{
23
21
  try {
24
- deserialized[key] = serializer.deserializeFromString(parsed[key]);
22
+ deserialized[key] = serializer.deserializeFromString(value);
25
23
  } catch (error) {
26
- deserialized[key] = parsed[key];
24
+ deserialized[key] = value;
27
25
  }
28
26
  });
29
27
  return deserialized;
@@ -34,9 +32,9 @@ const stringify = (object)=>{
34
32
  }
35
33
  const toSerialize = {};
36
34
  Object.keys(object).forEach((key)=>{
37
- toSerialize[key] = serializer.serializeToString(object[key]);
35
+ toSerialize[key] = type.isString(object[key]) ? object[key] : serializer.serializeToString(object[key]);
38
36
  });
39
- return queryString.stringify(toSerialize);
37
+ return new URLSearchParams(toSerialize).toString();
40
38
  };
41
39
  export default {
42
40
  stringify,
package/dist/wait.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -12,7 +12,7 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ async function wait(ms) {
15
+ */ function wait(ms) {
16
16
  return new Promise((resolve)=>setTimeout(resolve, ms));
17
17
  }
18
18
  export default wait;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/helpers",
3
- "version": "4.0.0-rc.9",
3
+ "version": "4.0.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -30,26 +30,23 @@
30
30
  "files": [
31
31
  "dist/*"
32
32
  ],
33
- "scripts": {
34
- "build": "swc src --out-dir dist --config-file ../../../.swcrc --delete-dir-on-start",
35
- "clean": "rm -rf dist",
36
- "prepublishOnly": "pnpm build",
37
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
38
- },
39
33
  "dependencies": {
40
- "lodash.merge": "4.6.2",
41
- "query-string": "8.1.0"
34
+ "lodash.merge": "4.6.2"
42
35
  },
43
36
  "devDependencies": {
44
- "@jest/globals": "28.1.0",
45
- "@swc/cli": "0.1.59",
46
- "@swc/core": "1.3.24",
47
- "@swc/jest": "0.2.24",
48
- "jest": "28.1.0",
49
- "jest-diff": "28.1.0"
37
+ "@jest/globals": "28.1.3",
38
+ "@swc/cli": "0.1.63",
39
+ "@swc/core": "1.3.99",
40
+ "@swc/jest": "0.2.29",
41
+ "jest": "28.1.3",
42
+ "jest-diff": "28.1.3"
50
43
  },
51
44
  "publishConfig": {
52
45
  "access": "public"
53
46
  },
54
- "gitHead": "d20e6ac424643feca527a732dc2b0710713c8243"
55
- }
47
+ "scripts": {
48
+ "build": "swc src --out-dir dist --config-file ../../../.swcrc --delete-dir-on-start",
49
+ "clean": "rm -rf dist",
50
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
51
+ }
52
+ }