Move select helper

js-version
Anton Medvedev 5 years ago
parent 5c228ccd77
commit 35526cc4d3

@ -4,6 +4,16 @@ const os = require('os')
const fs = require('fs')
const path = require('path')
const skip = Symbol('skip')
global.select = function select(cb) {
return json => {
if (!cb(json)) {
throw skip
}
return json
}
}
try {
require(path.join(os.homedir(), '.fxrc')) // Should be required before config.js usage.
} catch (err) {
@ -43,8 +53,6 @@ const usage = `
const {stdin, stdout, stderr} = process
const args = process.argv.slice(2)
const skip = Symbol('skip')
global.select = select
void function main() {
@ -121,13 +129,3 @@ function apply(json) {
console.log(text)
}
}
function select(cb) {
return json => {
if (!cb(json)) {
throw skip
}
return json
}
}

Loading…
Cancel
Save