@vpmedia/simplify 1.16.0 → 1.17.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @vpmedia/simplify
2
2
 
3
- [![npm version](https://badge.fury.io/js/@vpmedia%2Fsimplify.svg?v=1.16.0)](https://badge.fury.io/js/@vpmedia%2Fsimplify)
3
+ [![npm version](https://badge.fury.io/js/@vpmedia%2Fsimplify.svg?v=1.17.0)](https://badge.fury.io/js/@vpmedia%2Fsimplify)
4
4
  [![Node.js CI](https://github.com/vpmedia/simplify/actions/workflows/ci.yml/badge.svg)](https://github.com/vpmedia/simplify/actions/workflows/ci.yml)
5
5
 
6
6
  @vpmedia/simplify TBD
package/lefthook.yml CHANGED
@@ -1,7 +1,3 @@
1
- # Copyright (c) Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
2
- # author: Andras Csizmadia <andras@vpmedia.hu>
3
- # see: https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
4
-
5
1
  pre-commit:
6
2
  parallel: false
7
3
  commands:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/simplify",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "@vpmedia/simplify",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -19,32 +19,30 @@
19
19
  "types": "./types/index.d.ts",
20
20
  "type": "module",
21
21
  "devDependencies": {
22
- "@babel/preset-env": "^7.26.0",
23
- "@eslint/js": "^9.15.0",
22
+ "@babel/preset-env": "^7.26.9",
23
+ "@eslint/js": "^9.21.0",
24
24
  "@jest/globals": "^29.7.0",
25
25
  "@types/jest": "^29.5.14",
26
- "eslint": "^9.15.0",
27
- "eslint-plugin-jsdoc": "^50.5.0",
28
- "eslint-plugin-unicorn": "^56.0.1",
29
- "globals": "^15.12.0",
26
+ "eslint": "^9.22.0",
27
+ "eslint-plugin-jsdoc": "^50.6.3",
28
+ "eslint-plugin-unicorn": "^57.0.0",
29
+ "globals": "^16.0.0",
30
30
  "jest": "^29.7.0",
31
31
  "jest-environment-jsdom": "^29.7.0",
32
- "lefthook": "^1.8.4",
33
- "prettier": "^3.3.3",
34
- "typescript": "^5.7.2"
32
+ "prettier": "^3.5.3",
33
+ "typescript": "^5.8.2"
35
34
  },
36
35
  "scripts": {
37
36
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests",
38
37
  "lint": "eslint \"**/*.{js,jsx}\"",
39
38
  "typecheck": "tsc",
40
- "format": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json,md,css}\"",
41
- "lefthook:install": "lefthook install",
42
- "lefthook:uninstall": "lefthook uninstall"
39
+ "format": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json,md,css}\""
43
40
  },
44
41
  "browserslist": [
45
42
  "> 0.5%",
46
43
  "not dead",
47
- "not op_mini all"
44
+ "not op_mini all",
45
+ "iOS >= 14"
48
46
  ],
49
47
  "dependencies": {
50
48
  "eventemitter3": "^5.0.1"
package/src/index.js CHANGED
@@ -9,11 +9,12 @@ export { addLeadingZero } from './util/addLeadingZero.js';
9
9
  export { capitalize } from './util/capitalize.js';
10
10
  export { deg2rad } from './util/deg2rad.js';
11
11
  export { delayPromise } from './util/delayPromise.js';
12
- export { FetchError, HTTP_0_ANY, fetchRetry } from './util/fetchRetry.js';
12
+ export { FetchError, fetchRetry, HTTP_0_ANY } from './util/fetchRetry.js';
13
13
  export { fixFloatPrecision } from './util/fixFloatPrecision.js';
14
14
  export { getObjValueByPath } from './util/getObjValueByPath.js';
15
15
  export { getRandomInt } from './util/getRandomInt.js';
16
16
  export { getURLParam } from './util/getURLParam.js';
17
+ export { loadJSON } from './util/loadJSON.js';
17
18
  export { purgeObject } from './util/purgeObject.js';
18
19
  export { addFloat, fixFloat, subFloat } from './util/safeFloat.js';
19
20
  export { sanitizeURLParam } from './util/sanitizeURLParam.js';
@@ -1,4 +1,4 @@
1
- import { HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN, HTTP_405_METHOD_NOT_ALLOWED } from '../const/http_status.js';
1
+ import { HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN, HTTP_405_METHOD_NOT_ALLOWED, HTTP_422_UNPROCESSABLE_ENTITY } from '../const/http_status.js';
2
2
  import { Logger } from '../logging/Logger.js';
3
3
  import { delayPromise } from './delayPromise.js';
4
4
 
@@ -38,6 +38,7 @@ export const fetchRetry = async (resource, fetchOptions, retryOptions) => {
38
38
  HTTP_401_UNAUTHORIZED,
39
39
  HTTP_403_FORBIDDEN,
40
40
  HTTP_405_METHOD_NOT_ALLOWED,
41
+ HTTP_422_UNPROCESSABLE_ENTITY,
41
42
  ];
42
43
  while (retryOptions.numTries > 0) {
43
44
  logger.info('request', { resource, fetchOptions, retryOptions });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Load JSON file using a fetch GET request.
3
+ * @param {string} url - URL to load.
4
+ * @returns {Promise<string>} The parsed JSON data.
5
+ */
6
+ export async function loadJSON(url) {
7
+ const response = await fetch(url);
8
+ const json = await response.json();
9
+ return JSON.stringify(json);
10
+ }
package/types/index.d.ts CHANGED
@@ -12,11 +12,12 @@ export { fixFloatPrecision } from "./util/fixFloatPrecision.js";
12
12
  export { getObjValueByPath } from "./util/getObjValueByPath.js";
13
13
  export { getRandomInt } from "./util/getRandomInt.js";
14
14
  export { getURLParam } from "./util/getURLParam.js";
15
+ export { loadJSON } from "./util/loadJSON.js";
15
16
  export { purgeObject } from "./util/purgeObject.js";
16
17
  export { sanitizeURLParam } from "./util/sanitizeURLParam.js";
17
18
  export { saveAsFile } from "./util/saveAsFile.js";
18
19
  export { setObjValueByPath } from "./util/setObjValueByPath.js";
19
20
  export { underscoreToCamelCase } from "./util/underscoreToCamelCase.js";
20
- export { FetchError, HTTP_0_ANY, fetchRetry } from "./util/fetchRetry.js";
21
+ export { FetchError, fetchRetry, HTTP_0_ANY } from "./util/fetchRetry.js";
21
22
  export { addFloat, fixFloat, subFloat } from "./util/safeFloat.js";
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/pagelifecycle/util.js"],"names":[],"mappings":"AAsCO,gDAHI,OAAO,cAAc,EAAE,aAAa,GAAG,OAAO,cAAc,EAAE,kBAAkB,YAChF,MAAM,IAAI,QAMpB;AAgEM,0CAsBN;AAMM,yCAFM,MAAM,CAIlB;AAMM,oCAFM,OAAO,cAAc,EAAE,aAAa,CAIhD;AAMM,gDAFM,YAAY,CAOxB;AAMM,8CAFM,OAAO,CAInB;6BA9J4B,eAAe"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/pagelifecycle/util.js"],"names":[],"mappings":"AAsCO,gDAHI,OAAO,cAAc,EAAE,aAAa,GAAG,OAAO,cAAc,EAAE,kBAAkB,YAChF,MAAM,IAAI,QAMpB;AAgEM,0CAyBN;AAMM,yCAFM,MAAM,CAIlB;AAMM,oCAFM,OAAO,cAAc,EAAE,aAAa,CAIhD;AAMM,gDAFM,YAAY,CAOxB;AAMM,8CAFM,OAAO,CAInB;6BAjK4B,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetchRetry.d.ts","sourceRoot":"","sources":["../../src/util/fetchRetry.js"],"names":[],"mappings":"AAMA,yBAA0B,CAAC,CAAC;AAE5B;IACE;;;;;;OAMG;IACH,qBALW,MAAM,YACN,MAAM,GAAG,GAAG,GAAG,OAAO,gBACtB,WAAW,YACX,QAAQ,EAQlB;IAHC,iCAAwB;IACxB,0BAAgC;IAChC,mBAAwB;CAE3B;AASM,qCALI,MAAM,GAAG,GAAG,GAAG,OAAO,iBACtB,WAAW,iBACX;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,GAC5D,OAAO,CAAC,QAAQ,CAAC,CA0C7B"}
1
+ {"version":3,"file":"fetchRetry.d.ts","sourceRoot":"","sources":["../../src/util/fetchRetry.js"],"names":[],"mappings":"AAMA,yBAA0B,CAAC,CAAC;AAE5B;IACE;;;;;;OAMG;IACH,qBALW,MAAM,YACN,MAAM,GAAG,GAAG,GAAG,OAAO,gBACtB,WAAW,YACX,QAAQ,EAQlB;IAHC,iCAAwB;IACxB,0BAAgC;IAChC,mBAAwB;CAE3B;AASM,qCALI,MAAM,GAAG,GAAG,GAAG,OAAO,iBACtB,WAAW,iBACX;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,GAC5D,OAAO,CAAC,QAAQ,CAAC,CA2C7B"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Load JSON file using a fetch GET request.
3
+ * @param {string} url - URL to load.
4
+ * @returns {Promise<string>} The parsed JSON data.
5
+ */
6
+ export function loadJSON(url: string): Promise<string>;
7
+ //# sourceMappingURL=loadJSON.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadJSON.d.ts","sourceRoot":"","sources":["../../src/util/loadJSON.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,8BAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAM3B"}