ramda-cli
Version:
A command-line tool for processing JSON with Ramda and LiveScript
47 lines (46 loc) • 1.67 kB
JavaScript
// Generated by LiveScript 1.6.0
(function(){
var R, split, join, take, map, lines, words, unlines, unwords, HOME, isThenable, isBrowser, takeLines, mapLines, removeExtraNewlines, out$ = typeof exports != 'undefined' && exports || this;
R = require('ramda'), split = R.split, join = R.join, take = R.take, map = R.map;
out$.lines = lines = split('\n');
out$.words = words = split(' ');
out$.unlines = unlines = join('\n');
out$.unwords = unwords = join(' ');
out$.HOME = HOME = process.env[process.platform === 'win32' ? 'USERPROFILE' : 'HOME'];
out$.isThenable = isThenable = function(x){
return x && typeof x.then === 'function';
};
out$.isBrowser = isBrowser = function(){
return typeof importScripts === 'function' || typeof window !== 'undefined' && typeof window.document !== 'undefined';
};
out$.takeLines = takeLines = curry$(function(n, str){
return unlines(
take(n)(
lines(str)));
});
out$.mapLines = mapLines = curry$(function(fn, str){
return unlines(
map(fn)(
lines(str)));
});
out$.removeExtraNewlines = removeExtraNewlines = function(str){
if (/\n$/.exec(str)) {
return str.replace(/\n*$/, '\n');
} else {
return str;
}
};
function curry$(f, bound){
var context,
_curry = function(args) {
return f.length > 1 ? function(){
var params = args ? args.concat() : [];
context = bound ? context || this : this;
return params.push.apply(params, arguments) <
f.length && arguments.length ?
_curry.call(context, params) : f.apply(context, params);
} : f;
};
return _curry();
}
}).call(this);