Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stoplight/json

Package Overview
Dependencies
Maintainers
14
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/json - npm Package Compare versions

Comparing version 2.3.3 to 3.0.0

__tests__/decodePointer.d.ts

0

_utils.d.ts
export declare const replaceInString: (str: string, find: string, repl: string) => string;
export declare const decodePointer: (value: string) => string;
export declare const decodePointerFragment: (value: string) => string;
export declare const encodePointer: (value: string) => string;
import { Segment } from '@stoplight/types';
export declare const encodePointerFragment: (value: Segment) => Segment;
import { GetJsonPathForPosition } from '@stoplight/types';
import { IJsonASTNode } from './types';
export declare const getJsonPathForPosition: GetJsonPathForPosition<IJsonASTNode, number[]>;
export declare function getLastPathSegment(path: string): string;
import { GetLocationForJsonPath } from '@stoplight/types';
import { IJsonASTNode } from './types';
export declare const getLocationForJsonPath: GetLocationForJsonPath<IJsonASTNode, number[]>;

@@ -1,2 +0,1 @@

export * from './decycle';
export * from './decodePointer';

@@ -6,7 +5,14 @@ export * from './decodePointerFragment';

export * from './encodePointerFragment';
export * from './getJsonPathForPosition';
export * from './getLastPathSegment';
export * from './getLocationForJsonPath';
export * from './parseWithPointers';
export * from './pathToPointer';
export * from './pointerToPath';
export * from './renameObjectKey';
export * from './safeParse';
export * from './safeStringify';
export * from './startsWith';
export * from './toPropertyPath';
export * from './trimStart';
export * from './types';

11

package.json
{
"name": "@stoplight/json",
"version": "2.3.3",
"version": "3.0.0",
"description": "Useful functions when working with JSON.",

@@ -12,3 +12,2 @@ "keywords": [

],
"main": "index.js",
"sideEffects": false,

@@ -28,8 +27,10 @@ "files": [

"dependencies": {
"@stoplight/fast-safe-stringify": "^2.1.2",
"@stoplight/types": "^9.1.2",
"jsonc-parser": "~2.1.0",
"lodash": "^4.10"
"jsonc-parser": "~2.1",
"lodash": "^4.17",
"safe-stable-stringify": "^1.1"
},
"main": "index.cjs.js",
"module": "index.es.js",
"typings": "index.d.ts"
}

@@ -0,0 +0,0 @@ import { IDiagnostic, IParserASTResult, IParserResult } from '@stoplight/types';

export declare const pathToPointer: (path: import("@stoplight/types").Segment[]) => string;
export declare const pointerToPath: (pointer: string) => import("@stoplight/types").Segment[];

@@ -7,3 +7,2 @@ # @stoplight/json

- Explore the interfaces: [TSDoc](https://stoplightio.github.io/json)
- View the changelog: [Releases](https://github.com/stoplightio/json/releases)

@@ -22,3 +21,2 @@

- **[decycle](https://stoplightio.github.io/json/globals.html#decycle)**: Remove circular references with support for an optional replacer.
- **[parseWithPointers](https://stoplightio.github.io/json/globals.html#parsewithpointers)**: Like `JSON.parse(val)` but also returns parsing errors as well as full ast with line information.

@@ -36,6 +34,4 @@ - **[pathToPointer](https://stoplightio.github.io/json/globals.html#pathtopointer)**: Turns an array of path segments into a json pointer IE `['paths', '/user', 'get']` -> `#/paths/~1/user/get`.

_Note: Unlike most of the other functions, parseWithPointers is not exported from root. You must import by name._
```ts
import { parseWithPointers } from "@stoplight/json/parseWithPointers";
import { parseWithPointers } from "@stoplight/json";

@@ -42,0 +38,0 @@ const result = parseWithPointers('{"foo": "bar"}');

export declare const renameObjectKey: (obj: object, oldKey: string, newKey: string) => object;
export declare const safeParse: JSON['parse'];
export declare const safeStringify: (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined) => string;
export declare const startsWith: (source: string | any[], val: string | any[]) => boolean;
export declare function toPropertyPath(path: string): string;

@@ -1,1 +0,1 @@

export declare const trimStart: (target: string | any[], elems: string | any[]) => any;
export declare const trimStart: (target: string | any[], elems: string | any[]) => string | any[];

@@ -0,0 +0,0 @@ import { IRange } from '@stoplight/types';

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc