json-schema-ref-parser
Advanced tools
Comparing version 7.1.3 to 7.1.4
@@ -0,0 +0,0 @@ "use strict"; |
@@ -209,2 +209,4 @@ import { JSONSchema4, JSONSchema4Type, JSONSchema6, JSONSchema6Type } from 'json-schema'; | ||
http?: HTTPResolverOptions | boolean | ||
} & { | ||
[key: string]: Partial<ResolverOptions> | ||
} | ||
@@ -303,2 +305,12 @@ | ||
canParse?: boolean | RegExp | string | string[] | ((file: FileInfo) => boolean) | ||
/** | ||
* This is where the real work of a parser happens. The `parse` method accepts the same [file info object](file-info-object.md) as the `canParse` function, but rather than returning a boolean value, the `parse` method should return a JavaScript representation of the file contents. For our CSV parser, that is a two-dimensional array of lines and values. For your parser, it might be an object, a string, a custom class, or anything else. | ||
* | ||
* Unlike the `canParse` function, the `parse` method can also be asynchronous. This might be important if your parser needs to retrieve data from a database or if it relies on an external HTTP service to return the parsed value. You can return your asynchronous value via a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) or a Node.js-style error-first callback. Here are examples of both approaches: | ||
*/ | ||
parse( | ||
file: FileInfo, | ||
callback?: (error: Error | null, data: string | null) => any | ||
): unknown | Promise<unknown> | ||
} | ||
@@ -305,0 +317,0 @@ |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -32,3 +32,15 @@ "use strict"; | ||
exports.cwd = function cwd () { | ||
return process.browser ? location.href : process.cwd() + "/"; | ||
if (process.browser) { | ||
return location.href; | ||
} | ||
let path = process.cwd(); | ||
let lastChar = path.slice(-1); | ||
if (lastChar === "/" || lastChar === "\\") { | ||
return path; | ||
} | ||
else { | ||
return path + "/"; | ||
} | ||
}; | ||
@@ -35,0 +47,0 @@ |
{ | ||
"name": "json-schema-ref-parser", | ||
"version": "7.1.3", | ||
"version": "7.1.4", | ||
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133034
2793