path-loader
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -6,2 +6,9 @@ /** | ||
/** | ||
* Loads a document at the provided location and returns a JavaScript object representation. | ||
* @param location - The location to the document | ||
* @returns Always returns a promise even if there is a callback provided | ||
*/ | ||
export function load(location: LoadOptions): Promise.<any>; | ||
/** | ||
* Options used when loading a path. | ||
@@ -34,3 +41,3 @@ */ | ||
*/ | ||
declare type PrepareRequestCallback = (req: object, location: string, callback: Function)=>void; | ||
export type PrepareRequestCallback = (req: object, location: string, callback: Function)=>void; | ||
@@ -43,14 +50,7 @@ /** | ||
* @param callback - Error-first callback | ||
* @returns the result of processing the responsexs | ||
* @returns the result of processing the responses | ||
*/ | ||
declare type ProcessResponseCallback = (res: object, callback: Function)=>any; | ||
export type ProcessResponseCallback = (res: object, callback: Function)=>any; | ||
/** | ||
* Loads a document at the provided location and returns a JavaScript object representation. | ||
* @param location - The location to the document | ||
* @returns Always returns a promise even if there is a callback provided | ||
*/ | ||
export function load(location: LoadOptions): Promise.<*>; | ||
} | ||
36
index.js
@@ -56,36 +56,2 @@ /* | ||
/** | ||
* Options used when loading a path. | ||
* | ||
* @typedef {object} LoadOptions | ||
* | ||
* @property {string} [encoding='utf-8'] - The encoding to use when loading the file *(File loader only)* | ||
* @property {string} [method=get] - The HTTP method to use for the request *(HTTP loader only)* | ||
* @property {PrepareRequestCallback} [prepareRequest] - The callback used to prepare the request *(HTTP loader only)* | ||
* @property {ProcessResponseCallback} [processContent] - The callback used to process the response | ||
*/ | ||
/** | ||
* Callback used to provide access to altering a remote request prior to the request being made. | ||
* | ||
* @callback PrepareRequestCallback | ||
* | ||
* @param {object} req - The Superagent request object | ||
* @param {string} location - The location being retrieved | ||
* @param {function} callback - First callback | ||
*/ | ||
/** | ||
* Callback used to provide access to processing the raw response of the request being made. *(HTTP loader only)* | ||
* | ||
* @callback ProcessResponseCallback | ||
* | ||
* @param {object} res - The Superagent response object *(For non-HTTP loaders, this object will be like the Superagent | ||
* object in that it will have a `text` property whose value is the raw string value being processed. This was done | ||
* for consistency.)* | ||
* @param {function} callback - Error-first callback | ||
* | ||
* @returns {*} the result of processing the responsexs | ||
*/ | ||
function getLoader (location) { | ||
@@ -109,3 +75,3 @@ var scheme = getScheme(location); | ||
* | ||
* @param {LoadOptions} location - The location to the document | ||
* @param {module:path-loader~LoadOptions} location - The location to the document | ||
* | ||
@@ -112,0 +78,0 @@ * @returns {Promise<*>} Always returns a promise even if there is a callback provided |
{ | ||
"name": "path-loader", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Utility that provides a single API for loading the content of a path/URL.", | ||
@@ -52,2 +52,3 @@ "main": "index.js", | ||
"gulp-nsp": "^2.4.2", | ||
"gulp-replace": "^1.0.0", | ||
"gulp-uglify": "^3.0.0", | ||
@@ -54,0 +55,0 @@ "karma": "^1.6.0", |
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
23139
9
447
28