92 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			92 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// Generated by LiveScript 1.6.0
 | 
						|
var split, join, lines, unlines, words, unwords, chars, unchars, reverse, repeat, capitalize, camelize, dasherize;
 | 
						|
split = curry$(function(sep, str){
 | 
						|
  return str.split(sep);
 | 
						|
});
 | 
						|
join = curry$(function(sep, xs){
 | 
						|
  return xs.join(sep);
 | 
						|
});
 | 
						|
lines = function(str){
 | 
						|
  if (!str.length) {
 | 
						|
    return [];
 | 
						|
  }
 | 
						|
  return str.split('\n');
 | 
						|
};
 | 
						|
unlines = function(it){
 | 
						|
  return it.join('\n');
 | 
						|
};
 | 
						|
words = function(str){
 | 
						|
  if (!str.length) {
 | 
						|
    return [];
 | 
						|
  }
 | 
						|
  return str.split(/[ ]+/);
 | 
						|
};
 | 
						|
unwords = function(it){
 | 
						|
  return it.join(' ');
 | 
						|
};
 | 
						|
chars = function(it){
 | 
						|
  return it.split('');
 | 
						|
};
 | 
						|
unchars = function(it){
 | 
						|
  return it.join('');
 | 
						|
};
 | 
						|
reverse = function(str){
 | 
						|
  return str.split('').reverse().join('');
 | 
						|
};
 | 
						|
repeat = curry$(function(n, str){
 | 
						|
  var result, i$;
 | 
						|
  result = '';
 | 
						|
  for (i$ = 0; i$ < n; ++i$) {
 | 
						|
    result += str;
 | 
						|
  }
 | 
						|
  return result;
 | 
						|
});
 | 
						|
capitalize = function(str){
 | 
						|
  return str.charAt(0).toUpperCase() + str.slice(1);
 | 
						|
};
 | 
						|
camelize = function(it){
 | 
						|
  return it.replace(/[-_]+(.)?/g, function(arg$, c){
 | 
						|
    return (c != null ? c : '').toUpperCase();
 | 
						|
  });
 | 
						|
};
 | 
						|
dasherize = function(str){
 | 
						|
  return str.replace(/([^-A-Z])([A-Z]+)/g, function(arg$, lower, upper){
 | 
						|
    return lower + "-" + (upper.length > 1
 | 
						|
      ? upper
 | 
						|
      : upper.toLowerCase());
 | 
						|
  }).replace(/^([A-Z]+)/, function(arg$, upper){
 | 
						|
    if (upper.length > 1) {
 | 
						|
      return upper + "-";
 | 
						|
    } else {
 | 
						|
      return upper.toLowerCase();
 | 
						|
    }
 | 
						|
  });
 | 
						|
};
 | 
						|
module.exports = {
 | 
						|
  split: split,
 | 
						|
  join: join,
 | 
						|
  lines: lines,
 | 
						|
  unlines: unlines,
 | 
						|
  words: words,
 | 
						|
  unwords: unwords,
 | 
						|
  chars: chars,
 | 
						|
  unchars: unchars,
 | 
						|
  reverse: reverse,
 | 
						|
  repeat: repeat,
 | 
						|
  capitalize: capitalize,
 | 
						|
  camelize: camelize,
 | 
						|
  dasherize: dasherize
 | 
						|
};
 | 
						|
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();
 | 
						|
} |