README
WORK IN PROGRESS - DO NOT USE YET
Purefuncs
Automatically extract pure functions from your javascript code for unit testing.
Installation
npm install --save purefuncs
cli usage
Given:
// file: src/example.js
import {asd, boo} from 'asd'
import math from 'somewhere'
const z = 2;
function foo() {
const x = 3 + z;
function bla() {
const f = 5 + asd;
return x + 1;
}
function tada() {
return x + math.sin(x);
}
}
Run :
$ purefuncs src/example.js -o test/purefuncs/example.js
Output:
// file: test/purefuncs/example.js
export const foo = ({asd, math, z}) => () => {
const x = 3 + z;
function bla() {
const f = 5 + asd;
return x + 1;
}
function tada() {
return x + math.sin(x);
}
}
export const foo$bla = ({asd, x}) => () => {
const f = 5 + asd;
return x + 1;
}
export const foo$tada = ({math, x}) => () => {
return x + math.sin(x);
}
License
MIT