genish.js
Version:
37 lines (25 loc) • 614 B
JavaScript
let gen = require('./gen.js')
let proto = {
basename:'function',
gen() {
let out,
inputs = gen.getInputs( this )
out = ` var ${this.name} = `
if( isNaN( this.inputs[0] ) || isNaN( this.inputs[1] ) ) {
out += `(( ${inputs[0]} < ${inputs[1]}) | 0 )`
} else {
out += inputs[0] < inputs[1] ? 1 : 0
}
out += '\n'
gen.memo[ this.name ] = this.name
return [this.name, out]
return out
}
}
module.exports = (x,y) => {
let lt = Object.create( proto )
lt.inputs = [ x,y ]
lt.name = lt.basename + gen.getUID()
return lt
}