/promisify-jsonp

Promisify JSONP

Primary LanguageJavaScriptMIT LicenseMIT

promisify-jsonp

NPM version License

Light and robust JSONP library.

Installation

$ npm install --save promisify-jsonp

Usage

pjsonp(url, options);

Options

name type required default value description
callbackName String false - name of jsonp callback function
callbackNamePrefix String false __jp prefix for callbackName
callbackParamName String false callback parameter name of callbackName in query string
timeout Number false 0 request timeout(0 means no timeout)
params Object false {} extend parameter to query string
encode Boolean false true encode parameter in query string

Example

var pjsonp = require("pjsonp");

pjsonp("https://www.example.com/jsonp")
  .then((res) => {
    console.log(res);
  })
  .catch((err) => {
    console.log(err);
  });

License

MIT