react / wstein / node_modules / browserify / node_modules / module-deps / node_modules / detective / node_modules / escodegen / node_modules / optionator / node_modules / prelude-ls / lib / Str.js
80690 views// Generated by LiveScript 1.4.01var split, join, lines, unlines, words, unwords, chars, unchars, reverse, repeat, capitalize, camelize, dasherize;2split = curry$(function(sep, str){3return str.split(sep);4});5join = curry$(function(sep, xs){6return xs.join(sep);7});8lines = function(str){9if (!str.length) {10return [];11}12return str.split('\n');13};14unlines = function(it){15return it.join('\n');16};17words = function(str){18if (!str.length) {19return [];20}21return str.split(/[ ]+/);22};23unwords = function(it){24return it.join(' ');25};26chars = function(it){27return it.split('');28};29unchars = function(it){30return it.join('');31};32reverse = function(str){33return str.split('').reverse().join('');34};35repeat = curry$(function(n, str){36var result, i$;37result = '';38for (i$ = 0; i$ < n; ++i$) {39result += str;40}41return result;42});43capitalize = function(str){44return str.charAt(0).toUpperCase() + str.slice(1);45};46camelize = function(it){47return it.replace(/[-_]+(.)?/g, function(arg$, c){48return (c != null ? c : '').toUpperCase();49});50};51dasherize = function(str){52return str.replace(/([^-A-Z])([A-Z]+)/g, function(arg$, lower, upper){53return lower + "-" + (upper.length > 154? upper55: upper.toLowerCase());56}).replace(/^([A-Z]+)/, function(arg$, upper){57if (upper.length > 1) {58return upper + "-";59} else {60return upper.toLowerCase();61}62});63};64module.exports = {65split: split,66join: join,67lines: lines,68unlines: unlines,69words: words,70unwords: unwords,71chars: chars,72unchars: unchars,73reverse: reverse,74repeat: repeat,75capitalize: capitalize,76camelize: camelize,77dasherize: dasherize78};79function curry$(f, bound){80var context,81_curry = function(args) {82return f.length > 1 ? function(){83var params = args ? args.concat() : [];84context = bound ? context || this : this;85return params.push.apply(params, arguments) <86f.length && arguments.length ?87_curry.call(context, params) : f.apply(context, params);88} : f;89};90return _curry();91}9293