@@ -17,7 +17,6 @@ var Promise = require('./promise'),
1717 _isString = require ( 'lodash/lang/isString' ) ;
1818
1919module . exports = $RefParser ;
20- module . falsy && require ( './_preamble' ) ;
2120
2221/**
2322 * This class parses a JSON schema, builds a map of its JSON references and their resolved values,
@@ -54,12 +53,13 @@ function $RefParser() {
5453 * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object.
5554 *
5655 * @param {string|object } schema - The file path or URL of the JSON schema. Or a JSON schema object.
57- * @param {ParserOptions } [options] - Options that determine how the schema is parsed
56+ * @param {$RefParserOptions } [options] - Options that determine how the schema is parsed
5857 * @param {function } [callback] - An error-first callback. The second parameter is the parsed JSON schema object.
5958 * @returns {Promise } - The returned promise resolves with the parsed JSON schema object.
6059 */
6160$RefParser . parse = function ( schema , options , callback ) {
62- return new $RefParser ( ) . parse ( schema , options , callback ) ;
61+ var Class = this ;
62+ return new Class ( ) . parse ( schema , options , callback ) ;
6363} ;
6464
6565/**
@@ -68,7 +68,7 @@ $RefParser.parse = function(schema, options, callback) {
6868 * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object.
6969 *
7070 * @param {string|object } schema - The file path or URL of the JSON schema. Or a JSON schema object.
71- * @param {ParserOptions } [options] - Options that determine how the schema is parsed
71+ * @param {$RefParserOptions } [options] - Options that determine how the schema is parsed
7272 * @param {function } [callback] - An error-first callback. The second parameter is the parsed JSON schema object.
7373 * @returns {Promise } - The returned promise resolves with the parsed JSON schema object.
7474 */
@@ -124,23 +124,24 @@ $RefParser.prototype.parse = function(schema, options, callback) {
124124 * externally-referenced files.
125125 *
126126 * @param {string|object } schema - The file path or URL of the JSON schema. Or a JSON schema object.
127- * @param {ParserOptions } [options] - Options that determine how the schema is parsed and resolved
127+ * @param {$RefParserOptions } [options] - Options that determine how the schema is parsed and resolved
128128 * @param {function } [callback]
129129 * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references
130130 *
131131 * @returns {Promise }
132132 * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references
133133 */
134134$RefParser . resolve = function ( schema , options , callback ) {
135- return new $RefParser ( ) . resolve ( schema , options , callback ) ;
135+ var Class = this ;
136+ return new Class ( ) . resolve ( schema , options , callback ) ;
136137} ;
137138
138139/**
139140 * Parses the given JSON schema and resolves any JSON references, including references in
140141 * externally-referenced files.
141142 *
142143 * @param {string|object } schema - The file path or URL of the JSON schema. Or a JSON schema object.
143- * @param {ParserOptions } [options] - Options that determine how the schema is parsed and resolved
144+ * @param {$RefParserOptions } [options] - Options that determine how the schema is parsed and resolved
144145 * @param {function } [callback]
145146 * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references
146147 *
@@ -176,12 +177,13 @@ $RefParser.prototype.resolve = function(schema, options, callback) {
176177 * not any *external* references.
177178 *
178179 * @param {string|object } schema - The file path or URL of the JSON schema. Or a JSON schema object.
179- * @param {ParserOptions } [options] - Options that determine how the schema is parsed, resolved, and dereferenced
180+ * @param {$RefParserOptions } [options] - Options that determine how the schema is parsed, resolved, and dereferenced
180181 * @param {function } [callback] - An error-first callback. The second parameter is the bundled JSON schema object
181182 * @returns {Promise } - The returned promise resolves with the bundled JSON schema object.
182183 */
183184$RefParser . bundle = function ( schema , options , callback ) {
184- return new $RefParser ( ) . bundle ( schema , options , callback ) ;
185+ var Class = this ;
186+ return new Class ( ) . bundle ( schema , options , callback ) ;
185187} ;
186188
187189/**
@@ -190,7 +192,7 @@ $RefParser.bundle = function(schema, options, callback) {
190192 * not any *external* references.
191193 *
192194 * @param {string|object } schema - The file path or URL of the JSON schema. Or a JSON schema object.
193- * @param {ParserOptions } [options] - Options that determine how the schema is parsed, resolved, and dereferenced
195+ * @param {$RefParserOptions } [options] - Options that determine how the schema is parsed, resolved, and dereferenced
194196 * @param {function } [callback] - An error-first callback. The second parameter is the bundled JSON schema object
195197 * @returns {Promise } - The returned promise resolves with the bundled JSON schema object.
196198 */
@@ -220,20 +222,21 @@ $RefParser.prototype.bundle = function(schema, options, callback) {
220222 * That is, all JSON references are replaced with their resolved values.
221223 *
222224 * @param {string|object } schema - The file path or URL of the JSON schema. Or a JSON schema object.
223- * @param {ParserOptions } [options] - Options that determine how the schema is parsed, resolved, and dereferenced
225+ * @param {$RefParserOptions } [options] - Options that determine how the schema is parsed, resolved, and dereferenced
224226 * @param {function } [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object
225227 * @returns {Promise } - The returned promise resolves with the dereferenced JSON schema object.
226228 */
227229$RefParser . dereference = function ( schema , options , callback ) {
228- return new $RefParser ( ) . dereference ( schema , options , callback ) ;
230+ var Class = this ;
231+ return new Class ( ) . dereference ( schema , options , callback ) ;
229232} ;
230233
231234/**
232235 * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema.
233236 * That is, all JSON references are replaced with their resolved values.
234237 *
235238 * @param {string|object } schema - The file path or URL of the JSON schema. Or a JSON schema object.
236- * @param {ParserOptions } [options] - Options that determine how the schema is parsed, resolved, and dereferenced
239+ * @param {$RefParserOptions } [options] - Options that determine how the schema is parsed, resolved, and dereferenced
237240 * @param {function } [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object
238241 * @returns {Promise } - The returned promise resolves with the dereferenced JSON schema object.
239242 */
0 commit comments