Socket
Socket
Sign inDemoInstall

json-refs

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-refs - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

26

index.js

@@ -37,2 +37,3 @@ /*

isArray: require('lodash-compat/lang/isArray'),
isError: require('lodash-compat/lang/isError'),
isFunction: require('lodash-compat/lang/isFunction'),

@@ -381,6 +382,7 @@ isNumber: require('lodash-compat/lang/isNumber'),

function replaceReference (to, from, ref, refPtr) {
var isError = _.isError(from);
var missing = false;
var refMetadata = {
ref: ref
};
var missing = false;
var parentPath;

@@ -390,7 +392,15 @@ var refPath;

ref = ref.indexOf('#') === -1 ?
'#' :
ref.substring(ref.indexOf('#'));
missing = !from.has(pathFromPointer(ref));
value = from.get(pathFromPointer(ref));
if (isError) {
missing = true;
value = undefined;
refMetadata.err = from;
} else {
ref = ref.indexOf('#') === -1 ?
'#' :
ref.substring(ref.indexOf('#'));
missing = !from.has(pathFromPointer(ref));
value = from.get(pathFromPointer(ref));
}
refPath = pathFromPointer(refPtr);

@@ -445,3 +455,5 @@ parentPath = refPath.slice(0, refPath.length - 1);

if (err) {
reject(err);
replaceReference(cJsonT, err, ref, refPtr);
resolve();
} else {

@@ -448,0 +460,0 @@ resolveRefs(remoteJson, rOptions, function (err2, resolvedJson) {

{
"name": "json-refs",
"version": "0.3.0",
"version": "0.3.1",
"description": "Various utilities for JSON References (http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03).",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -140,2 +140,3 @@ # json-refs

* `ref {string}`: The reference value as it existed in the original document
* `[err] {*}`: The error whenever there was an issue resolving a remote reference
* `[value] {*}`: The resolved value of the reference, if there is one. If this property was set, this means that the

@@ -148,2 +149,7 @@ reference was resolvable and it resolved to an explicit value. If this property is not set, that means the reference

**Note** Unresolvable references do not stop reference resolution and will never cause an `Error` to be sent to the
callback. You will need to look into the `metadata` argument, documented above, to identify missing references. In
the event that an `Error` occurred while resolving the reference, typical for failed remote references, the metadata
entry will have the original `Error` produced.
`options.prepareRequest` and `options.processContent` are passed directly to [path-loader][path-loader] and they are

@@ -150,0 +156,0 @@ documented in greater detail there. Just to save you a few clicks, below are examples of using both.

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