Skip to content

Latest commit

 

History

History

partial

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Without Partial

const parseInt10 = function (str) {
    return parseInt(str, 10);
}
const parseInt16 = function (str) {
    return parseInt(str, 16);
}
const parseInt2 = function (str) {
    return parseInt(str, 2)
}

console.log((parseInt10('10'))); // => 10
console.log((parseInt16('10'))); // => 16
console.log((parseInt2('10'))); // => 2

With Partial

const F = require('../fp');

const parseInt10 = F.partial(parseInt, F._, 10);
const parseInt16 = F.partial(parseInt, F._, 16)
const parseInt2 = F.partial(parseInt, F._, 2);

console.log((parseInt10('10'))); // => 10
console.log((parseInt16('10'))); // => 16
console.log((parseInt2('10'))); // => 2