create-function

0.1.0 • Public • Published

create-function

Build Status Coverage Status dependencies Status devDependencies Status JavaScript Style Guide

Create functions supports partial options.

Install

$ npm install create-function

Usage

var jQuery = require('jquery')
var createFunction = require('create-function')

var ajax = createFunction(jQuery.ajax)
ajax({ url: 'https://api.github.com/' }) // Same as call jQuery.ajax

var post = ajax.create({ type: 'POST' })
post({ url: 'https://api.github.com/' }) // POST to GitHub API

var authorizedPost = post.create({
    username: 'user',
    password: 'pass'
})
authorizedPost({ url: 'https://api.github.com/' }) // POST to GitHub API with authorization

License

MIT

Package Sidebar

Install

npm i create-function

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • gerhut