Skip to content

allouis/method-call

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

method-call

This library allows you to use _ style method calls like in Scala.

Usage

import _ from 'method-call'

const names = ['fabien', 'donny', 'dave'];

const NAMES = names.map(_.toUpperCase); // ['FABIEN', 'DONNY', 'DAVE'];
import _ from 'method-call'
import Model from 'some-mvc'

class Document extends Model{
    constructor(id){
        this.id = id;
        super(id);
    }

    save(){
        const url = '/documents/' + this.id;
        return this.sync.post(url, this.attributes);
    }

}

let docs = [new Document(1), new Document(20)];

docs.forEach(_.save); // equiv to docs.forEach(d => d.save);

About

ES6 Implementation of the _ method calls in scala

Resources

Stars

Watchers

Forks

Packages

No packages published