Skip to content

Gerhut/create-function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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