11(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.$RefParser = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2- /**!
2+ /** !
33 * JSON Schema $Ref Parser v1.3.1
44 *
55 * @link https://github.com/BigstickCarpet/json-schema-ref-parser
@@ -62,7 +62,7 @@ function remap($refs, options) {
6262 * @param {$RefParserOptions} options
6363 */
6464function crawl(obj, path, $refs, remapped, options) {
65- if (obj && typeof( obj) === 'object') {
65+ if (obj && typeof obj === 'object') {
6666 Object.keys(obj).forEach(function(key) {
6767 var keyPath = Pointer.join(path, key);
6868 var value = obj[key];
@@ -143,7 +143,7 @@ function dereference(parser, options) {
143143function crawl(obj, path, parents, $refs, options) {
144144 var isCircular = false;
145145
146- if (obj && typeof( obj) === 'object') {
146+ if (obj && typeof obj === 'object') {
147147 parents.push(obj);
148148
149149 Object.keys(obj).forEach(function(key) {
@@ -201,7 +201,7 @@ function crawl(obj, path, parents, $refs, options) {
201201 * @returns {*} - Returns the dereferenced value
202202 */
203203function getDereferencedValue(currentValue, resolvedValue) {
204- if (resolvedValue && typeof( resolvedValue) === 'object' && Object.keys(currentValue).length > 1) {
204+ if (resolvedValue && typeof resolvedValue === 'object' && Object.keys(currentValue).length > 1) {
205205 // The current value has additional properties (other than "$ref"),
206206 // so merge the resolved value rather than completely replacing the reference
207207 var merged = {};
@@ -303,7 +303,7 @@ function $RefParser() {
303303 * @returns {Promise} - The returned promise resolves with the parsed JSON schema object.
304304 */
305305$RefParser.parse = function(schema, options, callback) {
306- var Class = this;
306+ var Class = this; // eslint-disable-line consistent-this
307307 return new Class().parse(schema, options, callback);
308308};
309309
@@ -320,7 +320,7 @@ $RefParser.parse = function(schema, options, callback) {
320320$RefParser.prototype.parse = function(schema, options, callback) {
321321 var args = normalizeArgs(arguments);
322322
323- if (args.schema && typeof( args.schema) === 'object') {
323+ if (args.schema && typeof args.schema === 'object') {
324324 // The schema is an object, not a path/url
325325 this.schema = args.schema;
326326 this._basePath = '';
@@ -330,7 +330,7 @@ $RefParser.prototype.parse = function(schema, options, callback) {
330330 return maybe(args.callback, Promise.resolve(this.schema));
331331 }
332332
333- if (!args.schema || typeof( args.schema) !== 'string') {
333+ if (!args.schema || typeof args.schema !== 'string') {
334334 var err = ono('Expected a file path, URL, or object. Got %s', args.schema);
335335 return maybe(args.callback, Promise.reject(err));
336336 }
@@ -345,17 +345,17 @@ $RefParser.prototype.parse = function(schema, options, callback) {
345345 // Read the schema file/url
346346 return read(args.schema, this.$refs, args.options)
347347 .then(function(cached$Ref) {
348- var $ref = cached$Ref.$ref;
349- if (!$ref. value || typeof($ref. value) !== 'object' || $ref. value instanceof Buffer) {
348+ var value = cached$Ref.$ref.value ;
349+ if (!value || typeof value !== 'object' || value instanceof Buffer) {
350350 throw ono.syntax('"%s" is not a valid JSON Schema', me._basePath);
351351 }
352352 else {
353- me.schema = $ref. value;
353+ me.schema = value;
354354 return maybe(args.callback, Promise.resolve(me.schema));
355355 }
356356 })
357- .catch(function(err ) {
358- return maybe(args.callback, Promise.reject(err ));
357+ .catch(function(e ) {
358+ return maybe(args.callback, Promise.reject(e ));
359359 });
360360};
361361
@@ -372,7 +372,7 @@ $RefParser.prototype.parse = function(schema, options, callback) {
372372 * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references
373373 */
374374$RefParser.resolve = function(schema, options, callback) {
375- var Class = this;
375+ var Class = this; // eslint-disable-line consistent-this
376376 return new Class().resolve(schema, options, callback);
377377};
378378
@@ -415,7 +415,7 @@ $RefParser.prototype.resolve = function(schema, options, callback) {
415415 * @returns {Promise} - The returned promise resolves with the bundled JSON schema object.
416416 */
417417$RefParser.bundle = function(schema, options, callback) {
418- var Class = this;
418+ var Class = this; // eslint-disable-line consistent-this
419419 return new Class().bundle(schema, options, callback);
420420};
421421
@@ -453,7 +453,7 @@ $RefParser.prototype.bundle = function(schema, options, callback) {
453453 * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object.
454454 */
455455$RefParser.dereference = function(schema, options, callback) {
456- var Class = this;
456+ var Class = this; // eslint-disable-line consistent-this
457457 return new Class().dereference(schema, options, callback);
458458};
459459
@@ -488,7 +488,7 @@ $RefParser.prototype.dereference = function(schema, options, callback) {
488488 */
489489function normalizeArgs(args) {
490490 var options = args[1], callback = args[2];
491- if (typeof( options) === 'function') {
491+ if (typeof options === 'function') {
492492 callback = options;
493493 options = undefined;
494494 }
@@ -505,6 +505,7 @@ function normalizeArgs(args) {
505505}).call(this,require("buffer").Buffer)
506506
507507},{"./bundle":1,"./dereference":2,"./options":4,"./promise":7,"./read":8,"./ref":9,"./refs":10,"./resolve":11,"./util":12,"./yaml":13,"buffer":17,"call-me-maybe":19,"ono":65,"url":90}],4:[function(require,module,exports){
508+ /* eslint lines-around-comment: [2, {beforeBlockComment: false}] */
508509'use strict';
509510
510511module.exports = $RefParserOptions;
@@ -697,8 +698,8 @@ function parse(data, path, options) {
697698 */
698699function isEmpty(value) {
699700 return !value ||
700- (typeof( value) === 'object' && Object.keys(value).length === 0) ||
701- (typeof( value) === 'string' && value.trim().length === 0) ||
701+ (typeof value === 'object' && Object.keys(value).length === 0) ||
702+ (typeof value === 'string' && value.trim().length === 0) ||
702703 (value instanceof Buffer && value.length === 0);
703704}
704705
@@ -941,7 +942,7 @@ function resolveIf$Ref(pointer, options) {
941942 * @returns {*} - Returns the assigned value
942943 */
943944function setValue(pointer, token, value) {
944- if (pointer.value && typeof( pointer.value) === 'object') {
945+ if (pointer.value && typeof pointer.value === 'object') {
945946 if (token === '-' && Array.isArray(pointer.value)) {
946947 pointer.value.push(value);
947948 }
@@ -956,8 +957,10 @@ function setValue(pointer, token, value) {
956957}
957958
958959},{"./ref":9,"./util":12,"ono":65,"url":90}],7:[function(require,module,exports){
960+ 'use strict';
961+
959962/** @type {Promise} **/
960- module.exports = typeof( Promise) === 'function' ? Promise : require('es6-promise').Promise;
963+ module.exports = typeof Promise === 'function' ? Promise : require('es6-promise').Promise;
961964
962965},{"es6-promise":23}],8:[function(require,module,exports){
963966(function (process,Buffer){
@@ -1137,16 +1140,16 @@ function download(protocol, u, options) {
11371140 util.debug('Downloading file: %s', u);
11381141
11391142 var req = protocol.get(
1140- {
1141- hostname: u.hostname,
1142- port: u.port,
1143- path: u.path,
1144- auth: u.auth
1145- },
1146- onResponse
1143+ {
1144+ hostname: u.hostname,
1145+ port: u.port,
1146+ path: u.path,
1147+ auth: u.auth
1148+ },
1149+ onResponse
11471150 );
11481151
1149- if (typeof( req.setTimeout) === 'function') {
1152+ if (typeof req.setTimeout === 'function') {
11501153 req.setTimeout(5000);
11511154 }
11521155
@@ -1162,6 +1165,11 @@ function download(protocol, u, options) {
11621165 reject(ono(err, 'Error downloading file "%s"', u.href));
11631166 }
11641167
1168+ /**
1169+ * Handles the response
1170+ *
1171+ * @param {Response} res
1172+ */
11651173 function onResponse(res) {
11661174 var body;
11671175
@@ -1357,7 +1365,7 @@ $Ref.prototype.set = function(path, value, options) {
13571365 * @returns {boolean}
13581366 */
13591367$Ref.is$Ref = function(value) {
1360- return value && typeof( value) === 'object' && typeof( value.$ref) === 'string' && value.$ref.length > 0;
1368+ return value && typeof value === 'object' && typeof value.$ref === 'string' && value.$ref.length > 0;
13611369};
13621370
13631371/**
@@ -1647,7 +1655,7 @@ function resolve(parser, options) {
16471655function crawl(obj, path, pathFromRoot, $refs, options) {
16481656 var promises = [];
16491657
1650- if (obj && typeof( obj) === 'object') {
1658+ if (obj && typeof obj === 'object') {
16511659 var keys = Object.keys(obj);
16521660
16531661 // If there's a "definitions" property, then crawl it FIRST.
@@ -1850,6 +1858,7 @@ exports.path.extname = function extname(path) {
18501858}).call(this,require('_process'))
18511859
18521860},{"_process":67,"debug":21}],13:[function(require,module,exports){
1861+ /* eslint lines-around-comment: [2, {beforeBlockComment: false}] */
18531862'use strict';
18541863
18551864var yaml = require('js-yaml');
@@ -1878,7 +1887,7 @@ module.exports = {
18781887 * @returns {string}
18791888 */
18801889 stringify: function yamlStringify(value, replacer, space) {
1881- var indent = (typeof( space) === 'string' ? space.length : space) || 2;
1890+ var indent = (typeof space === 'string' ? space.length : space) || 2;
18821891 return yaml.safeDump(value, {indent: indent});
18831892 }
18841893};
0 commit comments