@stryke/json 0.5.1 → 0.5.3

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
@@ -3,7 +3,7 @@
3
3
  <!-- markdownlint-disable -->
4
4
 
5
5
 
6
- <div align="center"><img src="https://pub-761b436209f44a4d886487c917806c08.r2.dev/storm-banner.gif" width="100%" alt="Storm Software" /></div>
6
+ <div align="center"><img src="https://public.storm-cdn.com/storm-banner.gif" width="100%" alt="Storm Software" /></div>
7
7
  <br />
8
8
 
9
9
  <div align="center">
@@ -22,7 +22,7 @@ This package is part of Storm Software's **đŸŒŠī¸ Stryke** monorepo. Stryke pac
22
22
 
23
23
  <h3 align="center">đŸ’ģ Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
24
24
 
25
- [![Version](https://img.shields.io/badge/version-0.1.4-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/stryke/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
+ [![Version](https://img.shields.io/badge/version-0.5.1-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/stryke/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
26
26
 
27
27
  > [!IMPORTANT] This repository, and the apps, libraries, and tools contained
28
28
  > within, is still in it's initial development phase. As a result, bugs and
@@ -52,7 +52,6 @@ flexibility and customization.
52
52
 
53
53
  <!-- START doctoc -->
54
54
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
55
-
56
55
  ## Table of Contents
57
56
 
58
57
  - [Installing](#installing)
@@ -246,7 +245,7 @@ specification. Contributions of any kind welcome!
246
245
  <br />
247
246
 
248
247
  <div align="center">
249
- <img src="https://pub-761b436209f44a4d886487c917806c08.r2.dev/logo-banner.png" width="100%" alt="Storm Software" />
248
+ <img src="https://public.storm-cdn.com/logo-banner.png" width="100%" alt="Storm Software" />
250
249
  </div>
251
250
  <br />
252
251
 
@@ -277,9 +276,9 @@ generation of development tools, please reach out on our
277
276
 
278
277
  <br />
279
278
 
280
- <div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png" alt="Storm Software" width="200px"/></a></div>
279
+ <div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/icon-fill.png" alt="Storm Software" width="200px"/></a></div>
281
280
  <br />
282
- <div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://pub-761b436209f44a4d886487c917806c08.r2.dev/visit-us-text.svg" alt="Visit us at stormsoftware.com" height="90px"/></a></div>
281
+ <div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/visit-us-text.svg" alt="Visit us at stormsoftware.com" height="90px"/></a></div>
283
282
 
284
283
  <br />
285
284
 
@@ -11,39 +11,40 @@ exports.parent = parent;
11
11
  exports.parseJsonPointer = parseJsonPointer;
12
12
  exports.unescapePointerSegment = unescapePointerSegment;
13
13
  var _isNumber = require("@stryke/type-checks/is-number");
14
- const i = /~1/g,
15
- s = /~0/g,
16
- u = /~/g,
17
- c = /\//g;
18
- function escapePointerSegment(n) {
19
- return !n.includes("/") && !n.includes("~") ? n : n.replace(u, "~0").replace(c, "~1");
14
+ var _isString = require("@stryke/type-checks/is-string");
15
+ const s = /~1/g,
16
+ u = /~0/g,
17
+ c = /~/g,
18
+ l = /\//g;
19
+ function escapePointerSegment(r) {
20
+ return !r.includes("/") && !r.includes("~") ? r : r.replace(c, "~0").replace(l, "~1");
20
21
  }
21
- function unescapePointerSegment(n) {
22
- return n.includes("~") ? n.replace(i, "/").replace(s, "~") : n;
22
+ function unescapePointerSegment(r) {
23
+ return r.includes("~") ? r.replace(s, "/").replace(u, "~") : r;
23
24
  }
24
- function parseJsonPointer(n) {
25
- return n ? n.slice(1).split("/").map(r => unescapePointerSegment(r)) : [];
25
+ function parseJsonPointer(r) {
26
+ return r ? r.slice(1).split("/").map(n => unescapePointerSegment(n)) : [];
26
27
  }
27
- function formatJsonPointer(n) {
28
- return isRoot(n) ? "" : `/${n.map(r => escapePointerSegment(String(r))).join("/")}`;
28
+ function formatJsonPointer(r) {
29
+ return isRoot(r) ? "" : `/${r.map(n => escapePointerSegment(String(n))).join("/")}`;
29
30
  }
30
- const isRoot = n => n.length === 0;
31
+ const isRoot = r => (0, _isString.isString)(r) ? r === "" : (0, _isNumber.isNumber)(r) ? r === 0 : Array.isArray(r) && r.length === 0;
31
32
  exports.isRoot = isRoot;
32
- function parent(n) {
33
- if (n.length === 0) throw new Error("NO_PARENT");
34
- return n.slice(0, -1);
33
+ function parent(r) {
34
+ if (r.length === 0) throw new Error("NO_PARENT");
35
+ return r.slice(0, -1);
35
36
  }
36
- function isValidIndex(n) {
37
- if ((0, _isNumber.isNumber)(n)) return !0;
38
- const r = Number.parseInt(n, 10);
39
- return String(r) === n && r >= 0;
37
+ function isValidIndex(r) {
38
+ if ((0, _isNumber.isNumber)(r)) return !0;
39
+ const n = Number.parseInt(r, 10);
40
+ return String(n) === r && n >= 0;
40
41
  }
41
- const isInteger = n => {
42
- const r = n.length;
42
+ const isInteger = r => {
43
+ const n = r.length;
43
44
  let t = 0,
44
45
  e;
45
- for (; t < r;) {
46
- if (e = n.codePointAt(t), e >= 48 && e <= 57) {
46
+ for (; t < n;) {
47
+ if (e = r.codePointAt(t), e >= 48 && e <= 57) {
47
48
  t++;
48
49
  continue;
49
50
  }
@@ -26,7 +26,7 @@ export declare function formatJsonPointer(path: JsonPointerPath): string;
26
26
  /**
27
27
  * Returns true if JSON Pointer points to root value, false otherwise.
28
28
  */
29
- export declare const isRoot: (path: string | number) => boolean;
29
+ export declare const isRoot: (path: string | number | JsonPointerPath) => boolean;
30
30
  /**
31
31
  * Returns parent path, e.g. for ['foo', 'bar', 'baz'] returns ['foo', 'bar'].
32
32
  */
@@ -1 +1 @@
1
- import{isNumber as o}from"@stryke/type-checks/is-number";const i=/~1/g,s=/~0/g,u=/~/g,c=/\//g;export function escapePointerSegment(n){return!n.includes("/")&&!n.includes("~")?n:n.replace(u,"~0").replace(c,"~1")}export function unescapePointerSegment(n){return n.includes("~")?n.replace(i,"/").replace(s,"~"):n}export function parseJsonPointer(n){return n?n.slice(1).split("/").map(r=>unescapePointerSegment(r)):[]}export function formatJsonPointer(n){return isRoot(n)?"":`/${n.map(r=>escapePointerSegment(String(r))).join("/")}`}export const isRoot=n=>n.length===0;export function parent(n){if(n.length===0)throw new Error("NO_PARENT");return n.slice(0,-1)}export function isValidIndex(n){if(o(n))return!0;const r=Number.parseInt(n,10);return String(r)===n&&r>=0}export const isInteger=n=>{const r=n.length;let t=0,e;for(;t<r;){if(e=n.codePointAt(t),e>=48&&e<=57){t++;continue}return!1}return!0};
1
+ import{isNumber as o}from"@stryke/type-checks/is-number";import{isString as i}from"@stryke/type-checks/is-string";const s=/~1/g,u=/~0/g,c=/~/g,l=/\//g;export function escapePointerSegment(r){return!r.includes("/")&&!r.includes("~")?r:r.replace(c,"~0").replace(l,"~1")}export function unescapePointerSegment(r){return r.includes("~")?r.replace(s,"/").replace(u,"~"):r}export function parseJsonPointer(r){return r?r.slice(1).split("/").map(n=>unescapePointerSegment(n)):[]}export function formatJsonPointer(r){return isRoot(r)?"":`/${r.map(n=>escapePointerSegment(String(n))).join("/")}`}export const isRoot=r=>i(r)?r==="":o(r)?r===0:Array.isArray(r)&&r.length===0;export function parent(r){if(r.length===0)throw new Error("NO_PARENT");return r.slice(0,-1)}export function isValidIndex(r){if(o(r))return!0;const n=Number.parseInt(r,10);return String(n)===r&&n>=0}export const isInteger=r=>{const n=r.length;let t=0,e;for(;t<n;){if(e=r.codePointAt(t),e>=48&&e<=57){t++;continue}return!1}return!0};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/json",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "type": "module",
5
5
  "description": "A package containing JSON parsing/stringify utilities used by Storm Software.",
6
6
  "repository": {
@@ -14,8 +14,8 @@
14
14
  "jsonc-parser": "3.3.1",
15
15
  "lines-and-columns": "2.0.4",
16
16
  "superjson": "2.2.2",
17
- "@stryke/type-checks": ">=0.1.1",
18
- "@stryke/types": ">=0.6.2"
17
+ "@stryke/type-checks": ">=0.1.3",
18
+ "@stryke/types": ">=0.7.2"
19
19
  },
20
20
  "publishConfig": { "access": "public" },
21
21
  "devDependencies": {},