underscore.string
Advanced tools
Comparing version 3.2.3 to 3.3.0
{ | ||
"name": "underscore.string", | ||
"version": "3.2.3", | ||
"version": "3.3.0', | ||
"description": "String manipulation extensions for Underscore.js javascript library.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://epeli.github.com/underscore.string/", |
@@ -6,3 +6,3 @@ var trim = require('./trim'); | ||
str = trim(str).replace(/[-_\s]+(.)?/g, function(match, c) { | ||
return c ? c.toUpperCase() : ""; | ||
return c ? c.toUpperCase() : ''; | ||
}); | ||
@@ -9,0 +9,0 @@ |
var makeString = require('./helper/makeString'); | ||
var from = "ąàáäâãåæăćčĉęèéëêĝĥìíïîĵłľńňòóöőôõðøśșşšŝťțţŭùúüűûñÿýçżźž", | ||
to = "aaaaaaaaaccceeeeeghiiiijllnnoooooooossssstttuuuuuunyyczzz"; | ||
var from = 'ąàáäâãåæăćčĉęèéëêĝĥìíïîĵłľńňòóöőôõðøśșşšŝťțţŭùúüűûñÿýçżźž', | ||
to = 'aaaaaaaaaccceeeeeghiiiijllnnoooooooossssstttuuuuuunyyczzz'; | ||
@@ -10,6 +10,6 @@ from += from.toUpperCase(); | ||
to = to.split(""); | ||
to = to.split(''); | ||
// for tokens requireing multitoken output | ||
from += "ß"; | ||
from += 'ß'; | ||
to.push('ss'); | ||
@@ -19,6 +19,6 @@ | ||
module.exports = function cleanDiacritics(str) { | ||
return makeString(str).replace(/.{1}/g, function(c){ | ||
var index = from.indexOf(c); | ||
return index === -1 ? c : to[index]; | ||
return makeString(str).replace(/.{1}/g, function(c){ | ||
var index = from.indexOf(c); | ||
return index === -1 ? c : to[index]; | ||
}); | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"description": "String manipulation extensions for Underscore.js javascript library", | ||
"version": "3.2.3", | ||
"version": "3.3.0', | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "underscore", |
@@ -1,10 +0,18 @@ | ||
/* underscore.string 3.2.2 | MIT licensed | http://epeli.github.com/underscore.string/ */ | ||
/* | ||
* Underscore.string | ||
* (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org> | ||
* Underscore.string is freely distributable under the terms of the MIT license. | ||
* Documentation: https://github.com/epeli/underscore.string | ||
* Some code is borrowed from MooTools and Alexandru Marasteanu. | ||
* Version '3.3.0' | ||
* @preserve | ||
*/ | ||
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.s=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
var trim = _dereq_('./trim'); | ||
var decap = _dereq_('./decapitalize'); | ||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var trim = require('./trim'); | ||
var decap = require('./decapitalize'); | ||
module.exports = function camelize(str, decapitalize) { | ||
str = trim(str).replace(/[-_\s]+(.)?/g, function(match, c) { | ||
return c ? c.toUpperCase() : ""; | ||
return c ? c.toUpperCase() : ''; | ||
}); | ||
@@ -19,4 +27,4 @@ | ||
},{"./decapitalize":10,"./trim":63}],2:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./decapitalize":10,"./trim":65}],2:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -30,4 +38,4 @@ module.exports = function capitalize(str, lowercaseRest) { | ||
},{"./helper/makeString":21}],3:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20}],3:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -38,3 +46,3 @@ module.exports = function chars(str) { | ||
},{"./helper/makeString":21}],4:[function(_dereq_,module,exports){ | ||
},{"./helper/makeString":20}],4:[function(require,module,exports){ | ||
module.exports = function chop(str, step) { | ||
@@ -47,6 +55,6 @@ if (str == null) return []; | ||
},{}],5:[function(_dereq_,module,exports){ | ||
var capitalize = _dereq_('./capitalize'); | ||
var camelize = _dereq_('./camelize'); | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{}],5:[function(require,module,exports){ | ||
var capitalize = require('./capitalize'); | ||
var camelize = require('./camelize'); | ||
var makeString = require('./helper/makeString'); | ||
@@ -58,4 +66,4 @@ module.exports = function classify(str) { | ||
},{"./camelize":1,"./capitalize":2,"./helper/makeString":21}],6:[function(_dereq_,module,exports){ | ||
var trim = _dereq_('./trim'); | ||
},{"./camelize":1,"./capitalize":2,"./helper/makeString":20}],6:[function(require,module,exports){ | ||
var trim = require('./trim'); | ||
@@ -66,8 +74,8 @@ module.exports = function clean(str) { | ||
},{"./trim":63}],7:[function(_dereq_,module,exports){ | ||
},{"./trim":65}],7:[function(require,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var makeString = require('./helper/makeString'); | ||
var from = "ąàáäâãåæăćčĉęèéëêĝĥìíïîĵłľńňòóöőôõðøśșşšŝťțţŭùúüűûñÿýçżźž", | ||
to = "aaaaaaaaaccceeeeeghiiiijllnnoooooooossssstttuuuuuunyyczzz"; | ||
var from = 'ąàáäâãåæăćčĉęèéëêĝĥìíïîĵłľńňòóöőôõðøśșşšŝťțţŭùúüűûñÿýçżźž', | ||
to = 'aaaaaaaaaccceeeeeghiiiijllnnoooooooossssstttuuuuuunyyczzz'; | ||
@@ -77,6 +85,6 @@ from += from.toUpperCase(); | ||
to = to.split(""); | ||
to = to.split(''); | ||
// for tokens requireing multitoken output | ||
from += "ß"; | ||
from += 'ß'; | ||
to.push('ss'); | ||
@@ -86,10 +94,10 @@ | ||
module.exports = function cleanDiacritics(str) { | ||
return makeString(str).replace(/.{1}/g, function(c){ | ||
var index = from.indexOf(c); | ||
return index === -1 ? c : to[index]; | ||
return makeString(str).replace(/.{1}/g, function(c){ | ||
var index = from.indexOf(c); | ||
return index === -1 ? c : to[index]; | ||
}); | ||
}; | ||
},{"./helper/makeString":21}],8:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20}],8:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -105,4 +113,4 @@ module.exports = function(str, substr) { | ||
},{"./helper/makeString":21}],9:[function(_dereq_,module,exports){ | ||
var trim = _dereq_('./trim'); | ||
},{"./helper/makeString":20}],9:[function(require,module,exports){ | ||
var trim = require('./trim'); | ||
@@ -113,4 +121,4 @@ module.exports = function dasherize(str) { | ||
},{"./trim":63}],10:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./trim":65}],10:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -122,4 +130,4 @@ module.exports = function decapitalize(str) { | ||
},{"./helper/makeString":21}],11:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20}],11:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -153,5 +161,5 @@ function getIndent(str) { | ||
},{"./helper/makeString":21}],12:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var toPositive = _dereq_('./helper/toPositive'); | ||
},{"./helper/makeString":20}],12:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
var toPositive = require('./helper/toPositive'); | ||
@@ -169,11 +177,11 @@ module.exports = function endsWith(str, ends, position) { | ||
},{"./helper/makeString":21,"./helper/toPositive":23}],13:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var escapeChars = _dereq_('./helper/escapeChars'); | ||
},{"./helper/makeString":20,"./helper/toPositive":22}],13:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
var escapeChars = require('./helper/escapeChars'); | ||
var regexString = "["; | ||
var regexString = '['; | ||
for(var key in escapeChars) { | ||
regexString += key; | ||
} | ||
regexString += "]"; | ||
regexString += ']'; | ||
@@ -189,3 +197,3 @@ var regex = new RegExp( regexString, 'g'); | ||
},{"./helper/escapeChars":18,"./helper/makeString":21}],14:[function(_dereq_,module,exports){ | ||
},{"./helper/escapeChars":17,"./helper/makeString":20}],14:[function(require,module,exports){ | ||
module.exports = function() { | ||
@@ -195,3 +203,3 @@ var result = {}; | ||
for (var prop in this) { | ||
if (!this.hasOwnProperty(prop) || prop.match(/^(?:include|contains|reverse|join|map)$/)) continue; | ||
if (!this.hasOwnProperty(prop) || prop.match(/^(?:include|contains|reverse|join|map|wrap)$/)) continue; | ||
result[prop] = this[prop]; | ||
@@ -203,147 +211,5 @@ } | ||
},{}],15:[function(_dereq_,module,exports){ | ||
// Underscore.string | ||
// (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org> | ||
// Underscore.string is freely distributable under the terms of the MIT license. | ||
// Documentation: https://github.com/epeli/underscore.string | ||
// Some code is borrowed from MooTools and Alexandru Marasteanu. | ||
// Version '3.2.2' | ||
},{}],15:[function(require,module,exports){ | ||
var makeString = require('./makeString'); | ||
'use strict'; | ||
function s(value) { | ||
/* jshint validthis: true */ | ||
if (!(this instanceof s)) return new s(value); | ||
this._wrapped = value; | ||
} | ||
s.VERSION = '3.2.2'; | ||
s.isBlank = _dereq_('./isBlank'); | ||
s.stripTags = _dereq_('./stripTags'); | ||
s.capitalize = _dereq_('./capitalize'); | ||
s.decapitalize = _dereq_('./decapitalize'); | ||
s.chop = _dereq_('./chop'); | ||
s.trim = _dereq_('./trim'); | ||
s.clean = _dereq_('./clean'); | ||
s.cleanDiacritics = _dereq_('./cleanDiacritics'); | ||
s.count = _dereq_('./count'); | ||
s.chars = _dereq_('./chars'); | ||
s.swapCase = _dereq_('./swapCase'); | ||
s.escapeHTML = _dereq_('./escapeHTML'); | ||
s.unescapeHTML = _dereq_('./unescapeHTML'); | ||
s.splice = _dereq_('./splice'); | ||
s.insert = _dereq_('./insert'); | ||
s.replaceAll = _dereq_('./replaceAll'); | ||
s.include = _dereq_('./include'); | ||
s.join = _dereq_('./join'); | ||
s.lines = _dereq_('./lines'); | ||
s.dedent = _dereq_('./dedent'); | ||
s.reverse = _dereq_('./reverse'); | ||
s.startsWith = _dereq_('./startsWith'); | ||
s.endsWith = _dereq_('./endsWith'); | ||
s.pred = _dereq_('./pred'); | ||
s.succ = _dereq_('./succ'); | ||
s.titleize = _dereq_('./titleize'); | ||
s.camelize = _dereq_('./camelize'); | ||
s.underscored = _dereq_('./underscored'); | ||
s.dasherize = _dereq_('./dasherize'); | ||
s.classify = _dereq_('./classify'); | ||
s.humanize = _dereq_('./humanize'); | ||
s.ltrim = _dereq_('./ltrim'); | ||
s.rtrim = _dereq_('./rtrim'); | ||
s.truncate = _dereq_('./truncate'); | ||
s.prune = _dereq_('./prune'); | ||
s.words = _dereq_('./words'); | ||
s.pad = _dereq_('./pad'); | ||
s.lpad = _dereq_('./lpad'); | ||
s.rpad = _dereq_('./rpad'); | ||
s.lrpad = _dereq_('./lrpad'); | ||
s.sprintf = _dereq_('./sprintf'); | ||
s.vsprintf = _dereq_('./vsprintf'); | ||
s.toNumber = _dereq_('./toNumber'); | ||
s.numberFormat = _dereq_('./numberFormat'); | ||
s.strRight = _dereq_('./strRight'); | ||
s.strRightBack = _dereq_('./strRightBack'); | ||
s.strLeft = _dereq_('./strLeft'); | ||
s.strLeftBack = _dereq_('./strLeftBack'); | ||
s.toSentence = _dereq_('./toSentence'); | ||
s.toSentenceSerial = _dereq_('./toSentenceSerial'); | ||
s.slugify = _dereq_('./slugify'); | ||
s.surround = _dereq_('./surround'); | ||
s.quote = _dereq_('./quote'); | ||
s.unquote = _dereq_('./unquote'); | ||
s.repeat = _dereq_('./repeat'); | ||
s.naturalCmp = _dereq_('./naturalCmp'); | ||
s.levenshtein = _dereq_('./levenshtein'); | ||
s.toBoolean = _dereq_('./toBoolean'); | ||
s.exports = _dereq_('./exports'); | ||
s.escapeRegExp = _dereq_('./helper/escapeRegExp'); | ||
s.wrap = _dereq_('./wrap'); | ||
s.map = _dereq_('./map'); | ||
// Aliases | ||
s.strip = s.trim; | ||
s.lstrip = s.ltrim; | ||
s.rstrip = s.rtrim; | ||
s.center = s.lrpad; | ||
s.rjust = s.lpad; | ||
s.ljust = s.rpad; | ||
s.contains = s.include; | ||
s.q = s.quote; | ||
s.toBool = s.toBoolean; | ||
s.camelcase = s.camelize; | ||
s.mapChars = s.map; | ||
// Implement chaining | ||
s.prototype = { | ||
value: function value() { | ||
return this._wrapped; | ||
} | ||
}; | ||
function fn2method(key, fn) { | ||
if (typeof fn !== "function") return; | ||
s.prototype[key] = function() { | ||
var args = [this._wrapped].concat(Array.prototype.slice.call(arguments)); | ||
var res = fn.apply(null, args); | ||
// if the result is non-string stop the chain and return the value | ||
return typeof res === 'string' ? new s(res) : res; | ||
}; | ||
} | ||
// Copy functions to instance methods for chaining | ||
for (var key in s) fn2method(key, s[key]); | ||
fn2method("tap", function tap(string, fn) { | ||
return fn(string); | ||
}); | ||
function prototype2method(methodName) { | ||
fn2method(methodName, function(context) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
return String.prototype[methodName].apply(context, args); | ||
}); | ||
} | ||
var prototypeMethods = [ | ||
"toUpperCase", | ||
"toLowerCase", | ||
"split", | ||
"replace", | ||
"slice", | ||
"substring", | ||
"substr", | ||
"concat" | ||
]; | ||
for (var method in prototypeMethods) prototype2method(prototypeMethods[method]); | ||
module.exports = s; | ||
},{"./camelize":1,"./capitalize":2,"./chars":3,"./chop":4,"./classify":5,"./clean":6,"./cleanDiacritics":7,"./count":8,"./dasherize":9,"./decapitalize":10,"./dedent":11,"./endsWith":12,"./escapeHTML":13,"./exports":14,"./helper/escapeRegExp":19,"./humanize":24,"./include":25,"./insert":26,"./isBlank":27,"./join":28,"./levenshtein":29,"./lines":30,"./lpad":31,"./lrpad":32,"./ltrim":33,"./map":34,"./naturalCmp":35,"./numberFormat":36,"./pad":37,"./pred":38,"./prune":39,"./quote":40,"./repeat":41,"./replaceAll":42,"./reverse":43,"./rpad":44,"./rtrim":45,"./slugify":46,"./splice":47,"./sprintf":48,"./startsWith":49,"./strLeft":50,"./strLeftBack":51,"./strRight":52,"./strRightBack":53,"./stripTags":54,"./succ":55,"./surround":56,"./swapCase":57,"./titleize":58,"./toBoolean":59,"./toNumber":60,"./toSentence":61,"./toSentenceSerial":62,"./trim":63,"./truncate":64,"./underscored":65,"./unescapeHTML":66,"./unquote":67,"./vsprintf":68,"./words":69,"./wrap":70}],16:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./makeString'); | ||
module.exports = function adjacent(str, direction) { | ||
@@ -357,4 +223,4 @@ str = makeString(str); | ||
},{"./makeString":21}],17:[function(_dereq_,module,exports){ | ||
var escapeRegExp = _dereq_('./escapeRegExp'); | ||
},{"./makeString":20}],16:[function(require,module,exports){ | ||
var escapeRegExp = require('./escapeRegExp'); | ||
@@ -370,3 +236,3 @@ module.exports = function defaultToWhiteSpace(characters) { | ||
},{"./escapeRegExp":19}],18:[function(_dereq_,module,exports){ | ||
},{"./escapeRegExp":18}],17:[function(require,module,exports){ | ||
/* We're explicitly defining the list of entities we want to escape. | ||
@@ -377,13 +243,13 @@ nbsp is an HTML entity, but we don't want to escape all space characters in a string, hence its omission in this map. | ||
var escapeChars = { | ||
'¢' : 'cent', | ||
'£' : 'pound', | ||
'¥' : 'yen', | ||
'€': 'euro', | ||
'©' :'copy', | ||
'®' : 'reg', | ||
'<' : 'lt', | ||
'>' : 'gt', | ||
'"' : 'quot', | ||
'&' : 'amp', | ||
"'" : '#39' | ||
'¢' : 'cent', | ||
'£' : 'pound', | ||
'¥' : 'yen', | ||
'€': 'euro', | ||
'©' :'copy', | ||
'®' : 'reg', | ||
'<' : 'lt', | ||
'>' : 'gt', | ||
'"' : 'quot', | ||
'&' : 'amp', | ||
'\'' : '#39' | ||
}; | ||
@@ -393,4 +259,4 @@ | ||
},{}],19:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./makeString'); | ||
},{}],18:[function(require,module,exports){ | ||
var makeString = require('./makeString'); | ||
@@ -401,3 +267,3 @@ module.exports = function escapeRegExp(str) { | ||
},{"./makeString":21}],20:[function(_dereq_,module,exports){ | ||
},{"./makeString":20}],19:[function(require,module,exports){ | ||
/* | ||
@@ -418,3 +284,3 @@ We're explicitly defining the list of entities that might see in escape HTML strings | ||
amp: '&', | ||
apos: "'" | ||
apos: '\'' | ||
}; | ||
@@ -424,3 +290,3 @@ | ||
},{}],21:[function(_dereq_,module,exports){ | ||
},{}],20:[function(require,module,exports){ | ||
/** | ||
@@ -434,3 +300,3 @@ * Ensure some object is a coerced to a string | ||
},{}],22:[function(_dereq_,module,exports){ | ||
},{}],21:[function(require,module,exports){ | ||
module.exports = function strRepeat(str, qty){ | ||
@@ -446,3 +312,3 @@ if (qty < 1) return ''; | ||
},{}],23:[function(_dereq_,module,exports){ | ||
},{}],22:[function(require,module,exports){ | ||
module.exports = function toPositive(number) { | ||
@@ -452,6 +318,6 @@ return number < 0 ? 0 : (+number || 0); | ||
},{}],24:[function(_dereq_,module,exports){ | ||
var capitalize = _dereq_('./capitalize'); | ||
var underscored = _dereq_('./underscored'); | ||
var trim = _dereq_('./trim'); | ||
},{}],23:[function(require,module,exports){ | ||
var capitalize = require('./capitalize'); | ||
var underscored = require('./underscored'); | ||
var trim = require('./trim'); | ||
@@ -462,4 +328,4 @@ module.exports = function humanize(str) { | ||
},{"./capitalize":2,"./trim":63,"./underscored":65}],25:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./capitalize":2,"./trim":65,"./underscored":67}],24:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -471,5 +337,150 @@ module.exports = function include(str, needle) { | ||
},{"./helper/makeString":21}],26:[function(_dereq_,module,exports){ | ||
var splice = _dereq_('./splice'); | ||
},{"./helper/makeString":20}],25:[function(require,module,exports){ | ||
/* | ||
* Underscore.string | ||
* (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org> | ||
* Underscore.string is freely distributable under the terms of the MIT license. | ||
* Documentation: https://github.com/epeli/underscore.string | ||
* Some code is borrowed from MooTools and Alexandru Marasteanu. | ||
* Version '3.3.0' | ||
* @preserve | ||
*/ | ||
'use strict'; | ||
function s(value) { | ||
/* jshint validthis: true */ | ||
if (!(this instanceof s)) return new s(value); | ||
this._wrapped = value; | ||
} | ||
s.VERSION = '3.3.0'; | ||
s.isBlank = require('./isBlank'); | ||
s.stripTags = require('./stripTags'); | ||
s.capitalize = require('./capitalize'); | ||
s.decapitalize = require('./decapitalize'); | ||
s.chop = require('./chop'); | ||
s.trim = require('./trim'); | ||
s.clean = require('./clean'); | ||
s.cleanDiacritics = require('./cleanDiacritics'); | ||
s.count = require('./count'); | ||
s.chars = require('./chars'); | ||
s.swapCase = require('./swapCase'); | ||
s.escapeHTML = require('./escapeHTML'); | ||
s.unescapeHTML = require('./unescapeHTML'); | ||
s.splice = require('./splice'); | ||
s.insert = require('./insert'); | ||
s.replaceAll = require('./replaceAll'); | ||
s.include = require('./include'); | ||
s.join = require('./join'); | ||
s.lines = require('./lines'); | ||
s.dedent = require('./dedent'); | ||
s.reverse = require('./reverse'); | ||
s.startsWith = require('./startsWith'); | ||
s.endsWith = require('./endsWith'); | ||
s.pred = require('./pred'); | ||
s.succ = require('./succ'); | ||
s.titleize = require('./titleize'); | ||
s.camelize = require('./camelize'); | ||
s.underscored = require('./underscored'); | ||
s.dasherize = require('./dasherize'); | ||
s.classify = require('./classify'); | ||
s.humanize = require('./humanize'); | ||
s.ltrim = require('./ltrim'); | ||
s.rtrim = require('./rtrim'); | ||
s.truncate = require('./truncate'); | ||
s.prune = require('./prune'); | ||
s.words = require('./words'); | ||
s.pad = require('./pad'); | ||
s.lpad = require('./lpad'); | ||
s.rpad = require('./rpad'); | ||
s.lrpad = require('./lrpad'); | ||
s.sprintf = require('./sprintf'); | ||
s.vsprintf = require('./vsprintf'); | ||
s.toNumber = require('./toNumber'); | ||
s.numberFormat = require('./numberFormat'); | ||
s.strRight = require('./strRight'); | ||
s.strRightBack = require('./strRightBack'); | ||
s.strLeft = require('./strLeft'); | ||
s.strLeftBack = require('./strLeftBack'); | ||
s.toSentence = require('./toSentence'); | ||
s.toSentenceSerial = require('./toSentenceSerial'); | ||
s.slugify = require('./slugify'); | ||
s.surround = require('./surround'); | ||
s.quote = require('./quote'); | ||
s.unquote = require('./unquote'); | ||
s.repeat = require('./repeat'); | ||
s.naturalCmp = require('./naturalCmp'); | ||
s.levenshtein = require('./levenshtein'); | ||
s.toBoolean = require('./toBoolean'); | ||
s.exports = require('./exports'); | ||
s.escapeRegExp = require('./helper/escapeRegExp'); | ||
s.wrap = require('./wrap'); | ||
s.map = require('./map'); | ||
// Aliases | ||
s.strip = s.trim; | ||
s.lstrip = s.ltrim; | ||
s.rstrip = s.rtrim; | ||
s.center = s.lrpad; | ||
s.rjust = s.lpad; | ||
s.ljust = s.rpad; | ||
s.contains = s.include; | ||
s.q = s.quote; | ||
s.toBool = s.toBoolean; | ||
s.camelcase = s.camelize; | ||
s.mapChars = s.map; | ||
// Implement chaining | ||
s.prototype = { | ||
value: function value() { | ||
return this._wrapped; | ||
} | ||
}; | ||
function fn2method(key, fn) { | ||
if (typeof fn !== 'function') return; | ||
s.prototype[key] = function() { | ||
var args = [this._wrapped].concat(Array.prototype.slice.call(arguments)); | ||
var res = fn.apply(null, args); | ||
// if the result is non-string stop the chain and return the value | ||
return typeof res === 'string' ? new s(res) : res; | ||
}; | ||
} | ||
// Copy functions to instance methods for chaining | ||
for (var key in s) fn2method(key, s[key]); | ||
fn2method('tap', function tap(string, fn) { | ||
return fn(string); | ||
}); | ||
function prototype2method(methodName) { | ||
fn2method(methodName, function(context) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
return String.prototype[methodName].apply(context, args); | ||
}); | ||
} | ||
var prototypeMethods = [ | ||
'toUpperCase', | ||
'toLowerCase', | ||
'split', | ||
'replace', | ||
'slice', | ||
'substring', | ||
'substr', | ||
'concat' | ||
]; | ||
for (var method in prototypeMethods) prototype2method(prototypeMethods[method]); | ||
module.exports = s; | ||
},{"./camelize":1,"./capitalize":2,"./chars":3,"./chop":4,"./classify":5,"./clean":6,"./cleanDiacritics":7,"./count":8,"./dasherize":9,"./decapitalize":10,"./dedent":11,"./endsWith":12,"./escapeHTML":13,"./exports":14,"./helper/escapeRegExp":18,"./humanize":23,"./include":24,"./insert":26,"./isBlank":27,"./join":28,"./levenshtein":29,"./lines":30,"./lpad":31,"./lrpad":32,"./ltrim":33,"./map":34,"./naturalCmp":35,"./numberFormat":38,"./pad":39,"./pred":40,"./prune":41,"./quote":42,"./repeat":43,"./replaceAll":44,"./reverse":45,"./rpad":46,"./rtrim":47,"./slugify":48,"./splice":49,"./sprintf":50,"./startsWith":51,"./strLeft":52,"./strLeftBack":53,"./strRight":54,"./strRightBack":55,"./stripTags":56,"./succ":57,"./surround":58,"./swapCase":59,"./titleize":60,"./toBoolean":61,"./toNumber":62,"./toSentence":63,"./toSentenceSerial":64,"./trim":65,"./truncate":66,"./underscored":67,"./unescapeHTML":68,"./unquote":69,"./vsprintf":70,"./words":71,"./wrap":72}],26:[function(require,module,exports){ | ||
var splice = require('./splice'); | ||
module.exports = function insert(str, i, substr) { | ||
@@ -479,4 +490,4 @@ return splice(str, i, 0, substr); | ||
},{"./splice":47}],27:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./splice":49}],27:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -487,4 +498,4 @@ module.exports = function isBlank(str) { | ||
},{"./helper/makeString":21}],28:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20}],28:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
var slice = [].slice; | ||
@@ -499,4 +510,4 @@ | ||
},{"./helper/makeString":21}],29:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20}],29:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -554,3 +565,3 @@ /** | ||
},{"./helper/makeString":21}],30:[function(_dereq_,module,exports){ | ||
},{"./helper/makeString":20}],30:[function(require,module,exports){ | ||
module.exports = function lines(str) { | ||
@@ -561,4 +572,4 @@ if (str == null) return []; | ||
},{}],31:[function(_dereq_,module,exports){ | ||
var pad = _dereq_('./pad'); | ||
},{}],31:[function(require,module,exports){ | ||
var pad = require('./pad'); | ||
@@ -569,4 +580,4 @@ module.exports = function lpad(str, length, padStr) { | ||
},{"./pad":37}],32:[function(_dereq_,module,exports){ | ||
var pad = _dereq_('./pad'); | ||
},{"./pad":39}],32:[function(require,module,exports){ | ||
var pad = require('./pad'); | ||
@@ -577,5 +588,5 @@ module.exports = function lrpad(str, length, padStr) { | ||
},{"./pad":37}],33:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var defaultToWhiteSpace = _dereq_('./helper/defaultToWhiteSpace'); | ||
},{"./pad":39}],33:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
var defaultToWhiteSpace = require('./helper/defaultToWhiteSpace'); | ||
var nativeTrimLeft = String.prototype.trimLeft; | ||
@@ -590,4 +601,4 @@ | ||
},{"./helper/defaultToWhiteSpace":17,"./helper/makeString":21}],34:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/defaultToWhiteSpace":16,"./helper/makeString":20}],34:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -602,3 +613,3 @@ module.exports = function(str, callback) { | ||
},{"./helper/makeString":21}],35:[function(_dereq_,module,exports){ | ||
},{"./helper/makeString":20}],35:[function(require,module,exports){ | ||
module.exports = function naturalCmp(str1, str2) { | ||
@@ -634,3 +645,284 @@ if (str1 == str2) return 0; | ||
},{}],36:[function(_dereq_,module,exports){ | ||
},{}],36:[function(require,module,exports){ | ||
(function(window) { | ||
var re = { | ||
not_string: /[^s]/, | ||
number: /[diefg]/, | ||
json: /[j]/, | ||
not_json: /[^j]/, | ||
text: /^[^\x25]+/, | ||
modulo: /^\x25{2}/, | ||
placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/, | ||
key: /^([a-z_][a-z_\d]*)/i, | ||
key_access: /^\.([a-z_][a-z_\d]*)/i, | ||
index_access: /^\[(\d+)\]/, | ||
sign: /^[\+\-]/ | ||
} | ||
function sprintf() { | ||
var key = arguments[0], cache = sprintf.cache | ||
if (!(cache[key] && cache.hasOwnProperty(key))) { | ||
cache[key] = sprintf.parse(key) | ||
} | ||
return sprintf.format.call(null, cache[key], arguments) | ||
} | ||
sprintf.format = function(parse_tree, argv) { | ||
var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "" | ||
for (i = 0; i < tree_length; i++) { | ||
node_type = get_type(parse_tree[i]) | ||
if (node_type === "string") { | ||
output[output.length] = parse_tree[i] | ||
} | ||
else if (node_type === "array") { | ||
match = parse_tree[i] // convenience purposes only | ||
if (match[2]) { // keyword argument | ||
arg = argv[cursor] | ||
for (k = 0; k < match[2].length; k++) { | ||
if (!arg.hasOwnProperty(match[2][k])) { | ||
throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k])) | ||
} | ||
arg = arg[match[2][k]] | ||
} | ||
} | ||
else if (match[1]) { // positional argument (explicit) | ||
arg = argv[match[1]] | ||
} | ||
else { // positional argument (implicit) | ||
arg = argv[cursor++] | ||
} | ||
if (get_type(arg) == "function") { | ||
arg = arg() | ||
} | ||
if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) { | ||
throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))) | ||
} | ||
if (re.number.test(match[8])) { | ||
is_positive = arg >= 0 | ||
} | ||
switch (match[8]) { | ||
case "b": | ||
arg = arg.toString(2) | ||
break | ||
case "c": | ||
arg = String.fromCharCode(arg) | ||
break | ||
case "d": | ||
case "i": | ||
arg = parseInt(arg, 10) | ||
break | ||
case "j": | ||
arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0) | ||
break | ||
case "e": | ||
arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential() | ||
break | ||
case "f": | ||
arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) | ||
break | ||
case "g": | ||
arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg) | ||
break | ||
case "o": | ||
arg = arg.toString(8) | ||
break | ||
case "s": | ||
arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg) | ||
break | ||
case "u": | ||
arg = arg >>> 0 | ||
break | ||
case "x": | ||
arg = arg.toString(16) | ||
break | ||
case "X": | ||
arg = arg.toString(16).toUpperCase() | ||
break | ||
} | ||
if (re.json.test(match[8])) { | ||
output[output.length] = arg | ||
} | ||
else { | ||
if (re.number.test(match[8]) && (!is_positive || match[3])) { | ||
sign = is_positive ? "+" : "-" | ||
arg = arg.toString().replace(re.sign, "") | ||
} | ||
else { | ||
sign = "" | ||
} | ||
pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " " | ||
pad_length = match[6] - (sign + arg).length | ||
pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : "" | ||
output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg) | ||
} | ||
} | ||
} | ||
return output.join("") | ||
} | ||
sprintf.cache = {} | ||
sprintf.parse = function(fmt) { | ||
var _fmt = fmt, match = [], parse_tree = [], arg_names = 0 | ||
while (_fmt) { | ||
if ((match = re.text.exec(_fmt)) !== null) { | ||
parse_tree[parse_tree.length] = match[0] | ||
} | ||
else if ((match = re.modulo.exec(_fmt)) !== null) { | ||
parse_tree[parse_tree.length] = "%" | ||
} | ||
else if ((match = re.placeholder.exec(_fmt)) !== null) { | ||
if (match[2]) { | ||
arg_names |= 1 | ||
var field_list = [], replacement_field = match[2], field_match = [] | ||
if ((field_match = re.key.exec(replacement_field)) !== null) { | ||
field_list[field_list.length] = field_match[1] | ||
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") { | ||
if ((field_match = re.key_access.exec(replacement_field)) !== null) { | ||
field_list[field_list.length] = field_match[1] | ||
} | ||
else if ((field_match = re.index_access.exec(replacement_field)) !== null) { | ||
field_list[field_list.length] = field_match[1] | ||
} | ||
else { | ||
throw new SyntaxError("[sprintf] failed to parse named argument key") | ||
} | ||
} | ||
} | ||
else { | ||
throw new SyntaxError("[sprintf] failed to parse named argument key") | ||
} | ||
match[2] = field_list | ||
} | ||
else { | ||
arg_names |= 2 | ||
} | ||
if (arg_names === 3) { | ||
throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported") | ||
} | ||
parse_tree[parse_tree.length] = match | ||
} | ||
else { | ||
throw new SyntaxError("[sprintf] unexpected placeholder") | ||
} | ||
_fmt = _fmt.substring(match[0].length) | ||
} | ||
return parse_tree | ||
} | ||
var vsprintf = function(fmt, argv, _argv) { | ||
_argv = (argv || []).slice(0) | ||
_argv.splice(0, 0, fmt) | ||
return sprintf.apply(null, _argv) | ||
} | ||
/** | ||
* helpers | ||
*/ | ||
function get_type(variable) { | ||
return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase() | ||
} | ||
function str_repeat(input, multiplier) { | ||
return Array(multiplier + 1).join(input) | ||
} | ||
/** | ||
* export to either browser or node.js | ||
*/ | ||
if (typeof exports !== "undefined") { | ||
exports.sprintf = sprintf | ||
exports.vsprintf = vsprintf | ||
} | ||
else { | ||
window.sprintf = sprintf | ||
window.vsprintf = vsprintf | ||
if (typeof define === "function" && define.amd) { | ||
define(function() { | ||
return { | ||
sprintf: sprintf, | ||
vsprintf: vsprintf | ||
} | ||
}) | ||
} | ||
} | ||
})(typeof window === "undefined" ? this : window); | ||
},{}],37:[function(require,module,exports){ | ||
(function (global){ | ||
/** | ||
* Module exports. | ||
*/ | ||
module.exports = deprecate; | ||
/** | ||
* Mark that a method should not be used. | ||
* Returns a modified function which warns once by default. | ||
* | ||
* If `localStorage.noDeprecation = true` is set, then it is a no-op. | ||
* | ||
* If `localStorage.throwDeprecation = true` is set, then deprecated functions | ||
* will throw an Error when invoked. | ||
* | ||
* If `localStorage.traceDeprecation = true` is set, then deprecated functions | ||
* will invoke `console.trace()` instead of `console.error()`. | ||
* | ||
* @param {Function} fn - the function to deprecate | ||
* @param {String} msg - the string to print to the console when `fn` is invoked | ||
* @returns {Function} a new "deprecated" version of `fn` | ||
* @api public | ||
*/ | ||
function deprecate (fn, msg) { | ||
if (config('noDeprecation')) { | ||
return fn; | ||
} | ||
var warned = false; | ||
function deprecated() { | ||
if (!warned) { | ||
if (config('throwDeprecation')) { | ||
throw new Error(msg); | ||
} else if (config('traceDeprecation')) { | ||
console.trace(msg); | ||
} else { | ||
console.warn(msg); | ||
} | ||
warned = true; | ||
} | ||
return fn.apply(this, arguments); | ||
} | ||
return deprecated; | ||
} | ||
/** | ||
* Checks `localStorage` for boolean values for the given `name`. | ||
* | ||
* @param {String} name | ||
* @returns {Boolean} | ||
* @api private | ||
*/ | ||
function config (name) { | ||
// accessing global.localStorage can trigger a DOMException in sandboxed iframes | ||
try { | ||
if (!global.localStorage) return false; | ||
} catch (_) { | ||
return false; | ||
} | ||
var val = global.localStorage[name]; | ||
if (null == val) return false; | ||
return String(val).toLowerCase() === 'true'; | ||
} | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}],38:[function(require,module,exports){ | ||
module.exports = function numberFormat(number, dec, dsep, tsep) { | ||
@@ -649,5 +941,5 @@ if (isNaN(number) || number == null) return ''; | ||
},{}],37:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var strRepeat = _dereq_('./helper/strRepeat'); | ||
},{}],39:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
var strRepeat = require('./helper/strRepeat'); | ||
@@ -666,16 +958,16 @@ module.exports = function pad(str, length, padStr, type) { | ||
switch (type) { | ||
case 'right': | ||
padlen = length - str.length; | ||
return str + strRepeat(padStr, padlen); | ||
case 'both': | ||
padlen = length - str.length; | ||
return strRepeat(padStr, Math.ceil(padlen / 2)) + str + strRepeat(padStr, Math.floor(padlen / 2)); | ||
default: // 'left' | ||
padlen = length - str.length; | ||
return strRepeat(padStr, padlen) + str; | ||
case 'right': | ||
padlen = length - str.length; | ||
return str + strRepeat(padStr, padlen); | ||
case 'both': | ||
padlen = length - str.length; | ||
return strRepeat(padStr, Math.ceil(padlen / 2)) + str + strRepeat(padStr, Math.floor(padlen / 2)); | ||
default: // 'left' | ||
padlen = length - str.length; | ||
return strRepeat(padStr, padlen) + str; | ||
} | ||
}; | ||
},{"./helper/makeString":21,"./helper/strRepeat":22}],38:[function(_dereq_,module,exports){ | ||
var adjacent = _dereq_('./helper/adjacent'); | ||
},{"./helper/makeString":20,"./helper/strRepeat":21}],40:[function(require,module,exports){ | ||
var adjacent = require('./helper/adjacent'); | ||
@@ -686,3 +978,3 @@ module.exports = function succ(str) { | ||
},{"./helper/adjacent":16}],39:[function(_dereq_,module,exports){ | ||
},{"./helper/adjacent":15}],41:[function(require,module,exports){ | ||
/** | ||
@@ -693,4 +985,4 @@ * _s.prune: a more elegant version of truncate | ||
*/ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var rtrim = _dereq_('./rtrim'); | ||
var makeString = require('./helper/makeString'); | ||
var rtrim = require('./rtrim'); | ||
@@ -705,4 +997,4 @@ module.exports = function prune(str, length, pruneStr) { | ||
var tmpl = function(c) { | ||
return c.toUpperCase() !== c.toLowerCase() ? 'A' : ' '; | ||
}, | ||
return c.toUpperCase() !== c.toLowerCase() ? 'A' : ' '; | ||
}, | ||
template = str.slice(0, length + 1).replace(/.(?=\W*\w*$)/g, tmpl); // 'Hello, world' -> 'HellAA AAAAA' | ||
@@ -718,4 +1010,4 @@ | ||
},{"./helper/makeString":21,"./rtrim":45}],40:[function(_dereq_,module,exports){ | ||
var surround = _dereq_('./surround'); | ||
},{"./helper/makeString":20,"./rtrim":47}],42:[function(require,module,exports){ | ||
var surround = require('./surround'); | ||
@@ -726,5 +1018,5 @@ module.exports = function quote(str, quoteChar) { | ||
},{"./surround":56}],41:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var strRepeat = _dereq_('./helper/strRepeat'); | ||
},{"./surround":58}],43:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
var strRepeat = require('./helper/strRepeat'); | ||
@@ -745,4 +1037,4 @@ module.exports = function repeat(str, qty, separator) { | ||
},{"./helper/makeString":21,"./helper/strRepeat":22}],42:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20,"./helper/strRepeat":21}],44:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -756,4 +1048,4 @@ module.exports = function replaceAll(str, find, replace, ignorecase) { | ||
},{"./helper/makeString":21}],43:[function(_dereq_,module,exports){ | ||
var chars = _dereq_('./chars'); | ||
},{"./helper/makeString":20}],45:[function(require,module,exports){ | ||
var chars = require('./chars'); | ||
@@ -764,4 +1056,4 @@ module.exports = function reverse(str) { | ||
},{"./chars":3}],44:[function(_dereq_,module,exports){ | ||
var pad = _dereq_('./pad'); | ||
},{"./chars":3}],46:[function(require,module,exports){ | ||
var pad = require('./pad'); | ||
@@ -772,5 +1064,5 @@ module.exports = function rpad(str, length, padStr) { | ||
},{"./pad":37}],45:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var defaultToWhiteSpace = _dereq_('./helper/defaultToWhiteSpace'); | ||
},{"./pad":39}],47:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
var defaultToWhiteSpace = require('./helper/defaultToWhiteSpace'); | ||
var nativeTrimRight = String.prototype.trimRight; | ||
@@ -785,6 +1077,6 @@ | ||
},{"./helper/defaultToWhiteSpace":17,"./helper/makeString":21}],46:[function(_dereq_,module,exports){ | ||
var trim = _dereq_('./trim'); | ||
var dasherize = _dereq_('./dasherize'); | ||
var cleanDiacritics = _dereq_("./cleanDiacritics"); | ||
},{"./helper/defaultToWhiteSpace":16,"./helper/makeString":20}],48:[function(require,module,exports){ | ||
var trim = require('./trim'); | ||
var dasherize = require('./dasherize'); | ||
var cleanDiacritics = require('./cleanDiacritics'); | ||
@@ -795,4 +1087,4 @@ module.exports = function slugify(str) { | ||
},{"./cleanDiacritics":7,"./dasherize":9,"./trim":63}],47:[function(_dereq_,module,exports){ | ||
var chars = _dereq_('./chars'); | ||
},{"./cleanDiacritics":7,"./dasherize":9,"./trim":65}],49:[function(require,module,exports){ | ||
var chars = require('./chars'); | ||
@@ -805,132 +1097,12 @@ module.exports = function splice(str, i, howmany, substr) { | ||
},{"./chars":3}],48:[function(_dereq_,module,exports){ | ||
// sprintf() for JavaScript 0.7-beta1 | ||
// http://www.diveintojavascript.com/projects/javascript-sprintf | ||
// | ||
// Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com> | ||
// All rights reserved. | ||
var strRepeat = _dereq_('./helper/strRepeat'); | ||
var toString = Object.prototype.toString; | ||
var sprintf = (function() { | ||
function get_type(variable) { | ||
return toString.call(variable).slice(8, -1).toLowerCase(); | ||
} | ||
},{"./chars":3}],50:[function(require,module,exports){ | ||
var deprecate = require('util-deprecate'); | ||
var str_repeat = strRepeat; | ||
module.exports = deprecate(require('sprintf-js').sprintf, | ||
'sprintf() will be removed in the next major release, use the sprintf-js package instead.'); | ||
var str_format = function() { | ||
if (!str_format.cache.hasOwnProperty(arguments[0])) { | ||
str_format.cache[arguments[0]] = str_format.parse(arguments[0]); | ||
} | ||
return str_format.format.call(null, str_format.cache[arguments[0]], arguments); | ||
}; | ||
},{"sprintf-js":36,"util-deprecate":37}],51:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
var toPositive = require('./helper/toPositive'); | ||
str_format.format = function(parse_tree, argv) { | ||
var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length; | ||
for (i = 0; i < tree_length; i++) { | ||
node_type = get_type(parse_tree[i]); | ||
if (node_type === 'string') { | ||
output.push(parse_tree[i]); | ||
} | ||
else if (node_type === 'array') { | ||
match = parse_tree[i]; // convenience purposes only | ||
if (match[2]) { // keyword argument | ||
arg = argv[cursor]; | ||
for (k = 0; k < match[2].length; k++) { | ||
if (!arg.hasOwnProperty(match[2][k])) { | ||
throw new Error(sprintf('[_.sprintf] property "%s" does not exist', match[2][k])); | ||
} | ||
arg = arg[match[2][k]]; | ||
} | ||
} else if (match[1]) { // positional argument (explicit) | ||
arg = argv[match[1]]; | ||
} | ||
else { // positional argument (implicit) | ||
arg = argv[cursor++]; | ||
} | ||
if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) { | ||
throw new Error(sprintf('[_.sprintf] expecting number but found %s', get_type(arg))); | ||
} | ||
switch (match[8]) { | ||
case 'b': arg = arg.toString(2); break; | ||
case 'c': arg = String.fromCharCode(arg); break; | ||
case 'd': arg = parseInt(arg, 10); break; | ||
case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break; | ||
case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break; | ||
case 'o': arg = arg.toString(8); break; | ||
case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break; | ||
case 'u': arg = Math.abs(arg); break; | ||
case 'x': arg = arg.toString(16); break; | ||
case 'X': arg = arg.toString(16).toUpperCase(); break; | ||
} | ||
arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg); | ||
pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' '; | ||
pad_length = match[6] - String(arg).length; | ||
pad = match[6] ? str_repeat(pad_character, pad_length) : ''; | ||
output.push(match[5] ? arg + pad : pad + arg); | ||
} | ||
} | ||
return output.join(''); | ||
}; | ||
str_format.cache = {}; | ||
str_format.parse = function(fmt) { | ||
var _fmt = fmt, match = [], parse_tree = [], arg_names = 0; | ||
while (_fmt) { | ||
if ((match = /^[^\x25]+/.exec(_fmt)) !== null) { | ||
parse_tree.push(match[0]); | ||
} | ||
else if ((match = /^\x25{2}/.exec(_fmt)) !== null) { | ||
parse_tree.push('%'); | ||
} | ||
else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) { | ||
if (match[2]) { | ||
arg_names |= 1; | ||
var field_list = [], replacement_field = match[2], field_match = []; | ||
if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) { | ||
field_list.push(field_match[1]); | ||
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { | ||
if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) { | ||
field_list.push(field_match[1]); | ||
} | ||
else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) { | ||
field_list.push(field_match[1]); | ||
} | ||
else { | ||
throw new Error('[_.sprintf] huh?'); | ||
} | ||
} | ||
} | ||
else { | ||
throw new Error('[_.sprintf] huh?'); | ||
} | ||
match[2] = field_list; | ||
} | ||
else { | ||
arg_names |= 2; | ||
} | ||
if (arg_names === 3) { | ||
throw new Error('[_.sprintf] mixing positional and named placeholders is not (yet) supported'); | ||
} | ||
parse_tree.push(match); | ||
} | ||
else { | ||
throw new Error('[_.sprintf] huh?'); | ||
} | ||
_fmt = _fmt.substring(match[0].length); | ||
} | ||
return parse_tree; | ||
}; | ||
return str_format; | ||
})(); | ||
module.exports = sprintf; | ||
},{"./helper/strRepeat":22}],49:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var toPositive = _dereq_('./helper/toPositive'); | ||
module.exports = function startsWith(str, starts, position) { | ||
@@ -943,4 +1115,4 @@ str = makeString(str); | ||
},{"./helper/makeString":21,"./helper/toPositive":23}],50:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20,"./helper/toPositive":22}],52:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -954,4 +1126,4 @@ module.exports = function strLeft(str, sep) { | ||
},{"./helper/makeString":21}],51:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20}],53:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -965,4 +1137,4 @@ module.exports = function strLeftBack(str, sep) { | ||
},{"./helper/makeString":21}],52:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20}],54:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -976,4 +1148,4 @@ module.exports = function strRight(str, sep) { | ||
},{"./helper/makeString":21}],53:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20}],55:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -987,4 +1159,4 @@ module.exports = function strRightBack(str, sep) { | ||
},{"./helper/makeString":21}],54:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20}],56:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -995,4 +1167,4 @@ module.exports = function stripTags(str) { | ||
},{"./helper/makeString":21}],55:[function(_dereq_,module,exports){ | ||
var adjacent = _dereq_('./helper/adjacent'); | ||
},{"./helper/makeString":20}],57:[function(require,module,exports){ | ||
var adjacent = require('./helper/adjacent'); | ||
@@ -1003,3 +1175,3 @@ module.exports = function succ(str) { | ||
},{"./helper/adjacent":16}],56:[function(_dereq_,module,exports){ | ||
},{"./helper/adjacent":15}],58:[function(require,module,exports){ | ||
module.exports = function surround(str, wrapper) { | ||
@@ -1009,4 +1181,4 @@ return [wrapper, str, wrapper].join(''); | ||
},{}],57:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{}],59:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -1019,4 +1191,4 @@ module.exports = function swapCase(str) { | ||
},{"./helper/makeString":21}],58:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/makeString":20}],60:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -1029,4 +1201,4 @@ module.exports = function titleize(str) { | ||
},{"./helper/makeString":21}],59:[function(_dereq_,module,exports){ | ||
var trim = _dereq_('./trim'); | ||
},{"./helper/makeString":20}],61:[function(require,module,exports){ | ||
var trim = require('./trim'); | ||
@@ -1045,10 +1217,10 @@ function boolMatch(s, matchers) { | ||
module.exports = function toBoolean(str, trueValues, falseValues) { | ||
if (typeof str === "number") str = "" + str; | ||
if (typeof str !== "string") return !!str; | ||
if (typeof str === 'number') str = '' + str; | ||
if (typeof str !== 'string') return !!str; | ||
str = trim(str); | ||
if (boolMatch(str, trueValues || ["true", "1"])) return true; | ||
if (boolMatch(str, falseValues || ["false", "0"])) return false; | ||
if (boolMatch(str, trueValues || ['true', '1'])) return true; | ||
if (boolMatch(str, falseValues || ['false', '0'])) return false; | ||
}; | ||
},{"./trim":63}],60:[function(_dereq_,module,exports){ | ||
},{"./trim":65}],62:[function(require,module,exports){ | ||
module.exports = function toNumber(num, precision) { | ||
@@ -1060,4 +1232,4 @@ if (num == null) return 0; | ||
},{}],61:[function(_dereq_,module,exports){ | ||
var rtrim = _dereq_('./rtrim'); | ||
},{}],63:[function(require,module,exports){ | ||
var rtrim = require('./rtrim'); | ||
@@ -1075,4 +1247,4 @@ module.exports = function toSentence(array, separator, lastSeparator, serial) { | ||
},{"./rtrim":45}],62:[function(_dereq_,module,exports){ | ||
var toSentence = _dereq_('./toSentence'); | ||
},{"./rtrim":47}],64:[function(require,module,exports){ | ||
var toSentence = require('./toSentence'); | ||
@@ -1083,5 +1255,5 @@ module.exports = function toSentenceSerial(array, sep, lastSep) { | ||
},{"./toSentence":61}],63:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var defaultToWhiteSpace = _dereq_('./helper/defaultToWhiteSpace'); | ||
},{"./toSentence":63}],65:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
var defaultToWhiteSpace = require('./helper/defaultToWhiteSpace'); | ||
var nativeTrim = String.prototype.trim; | ||
@@ -1096,4 +1268,4 @@ | ||
},{"./helper/defaultToWhiteSpace":17,"./helper/makeString":21}],64:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
},{"./helper/defaultToWhiteSpace":16,"./helper/makeString":20}],66:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
@@ -1107,4 +1279,4 @@ module.exports = function truncate(str, length, truncateStr) { | ||
},{"./helper/makeString":21}],65:[function(_dereq_,module,exports){ | ||
var trim = _dereq_('./trim'); | ||
},{"./helper/makeString":20}],67:[function(require,module,exports){ | ||
var trim = require('./trim'); | ||
@@ -1115,5 +1287,5 @@ module.exports = function underscored(str) { | ||
},{"./trim":63}],66:[function(_dereq_,module,exports){ | ||
var makeString = _dereq_('./helper/makeString'); | ||
var htmlEntities = _dereq_('./helper/htmlEntities'); | ||
},{"./trim":65}],68:[function(require,module,exports){ | ||
var makeString = require('./helper/makeString'); | ||
var htmlEntities = require('./helper/htmlEntities'); | ||
@@ -1138,3 +1310,3 @@ module.exports = function unescapeHTML(str) { | ||
},{"./helper/htmlEntities":20,"./helper/makeString":21}],67:[function(_dereq_,module,exports){ | ||
},{"./helper/htmlEntities":19,"./helper/makeString":20}],69:[function(require,module,exports){ | ||
module.exports = function unquote(str, quoteChar) { | ||
@@ -1147,13 +1319,11 @@ quoteChar = quoteChar || '"'; | ||
},{}],68:[function(_dereq_,module,exports){ | ||
var sprintf = _dereq_('./sprintf'); | ||
},{}],70:[function(require,module,exports){ | ||
var deprecate = require('util-deprecate'); | ||
module.exports = function vsprintf(fmt, argv) { | ||
argv.unshift(fmt); | ||
return sprintf.apply(null, argv); | ||
}; | ||
module.exports = deprecate(require('sprintf-js').vsprintf, | ||
'vsprintf() will be removed in the next major release, use the sprintf-js package instead.'); | ||
},{"./sprintf":48}],69:[function(_dereq_,module,exports){ | ||
var isBlank = _dereq_('./isBlank'); | ||
var trim = _dereq_('./trim'); | ||
},{"sprintf-js":36,"util-deprecate":37}],71:[function(require,module,exports){ | ||
var isBlank = require('./isBlank'); | ||
var trim = require('./trim'); | ||
@@ -1165,108 +1335,106 @@ module.exports = function words(str, delimiter) { | ||
},{"./isBlank":27,"./trim":63}],70:[function(_dereq_,module,exports){ | ||
},{"./isBlank":27,"./trim":65}],72:[function(require,module,exports){ | ||
// Wrap | ||
// wraps a string by a certain width | ||
var makeString = _dereq_('./helper/makeString'); | ||
var makeString = require('./helper/makeString'); | ||
module.exports = function wrap(str, options){ | ||
str = makeString(str); | ||
options = options || {}; | ||
var width = options.width || 75; | ||
var seperator = options.seperator || '\n'; | ||
var cut = options.cut || false; | ||
var preserveSpaces = options.preserveSpaces || false; | ||
var trailingSpaces = options.trailingSpaces || false; | ||
str = makeString(str); | ||
options = options || {}; | ||
var width = options.width || 75; | ||
var seperator = options.seperator || '\n'; | ||
var cut = options.cut || false; | ||
var preserveSpaces = options.preserveSpaces || false; | ||
var trailingSpaces = options.trailingSpaces || false; | ||
var result; | ||
if(width <= 0){ | ||
return str; | ||
} | ||
else if(!cut){ | ||
var words = str.split(" "); | ||
var current_column = 0; | ||
result = ""; | ||
while(words.length > 0){ | ||
// if adding a space and the next word would cause this line to be longer than width... | ||
if(1 + words[0].length + current_column > width){ | ||
//start a new line if this line is not already empty | ||
if(current_column > 0){ | ||
// add a space at the end of the line is preserveSpaces is true | ||
if (preserveSpaces){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
else if(trailingSpaces){ | ||
while(current_column < width){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
} | ||
//start new line | ||
result += seperator; | ||
current_column = 0; | ||
} | ||
} | ||
// if not at the begining of the line, add a space in front of the word | ||
if(current_column > 0){ | ||
result += " "; | ||
current_column++; | ||
} | ||
// tack on the next word, update current column, a pop words array | ||
result += words[0]; | ||
current_column += words[0].length; | ||
words.shift(); | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
if(trailingSpaces){ | ||
while(current_column < width){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
} | ||
return result; | ||
} | ||
else { | ||
var index = 0; | ||
result = ""; | ||
// walk through each character and add seperators where appropriate | ||
while(index < str.length){ | ||
if(index % width == 0 && index > 0){ | ||
result += seperator; | ||
} | ||
result += str.charAt(index); | ||
index++; | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
if(trailingSpaces){ | ||
while(index % width > 0){ | ||
result += ' '; | ||
index++; | ||
} | ||
} | ||
return result; | ||
} | ||
if(width <= 0){ | ||
return str; | ||
} | ||
else if(!cut){ | ||
var words = str.split(' '); | ||
var current_column = 0; | ||
result = ''; | ||
while(words.length > 0){ | ||
// if adding a space and the next word would cause this line to be longer than width... | ||
if(1 + words[0].length + current_column > width){ | ||
//start a new line if this line is not already empty | ||
if(current_column > 0){ | ||
// add a space at the end of the line is preserveSpaces is true | ||
if (preserveSpaces){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
else if(trailingSpaces){ | ||
while(current_column < width){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
} | ||
//start new line | ||
result += seperator; | ||
current_column = 0; | ||
} | ||
} | ||
// if not at the begining of the line, add a space in front of the word | ||
if(current_column > 0){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
// tack on the next word, update current column, a pop words array | ||
result += words[0]; | ||
current_column += words[0].length; | ||
words.shift(); | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
if(trailingSpaces){ | ||
while(current_column < width){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
} | ||
return result; | ||
} | ||
else { | ||
var index = 0; | ||
result = ''; | ||
// walk through each character and add seperators where appropriate | ||
while(index < str.length){ | ||
if(index % width == 0 && index > 0){ | ||
result += seperator; | ||
} | ||
result += str.charAt(index); | ||
index++; | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
if(trailingSpaces){ | ||
while(index % width > 0){ | ||
result += ' '; | ||
index++; | ||
} | ||
} | ||
return result; | ||
} | ||
}; | ||
},{"./helper/makeString":21}]},{},[15]) | ||
(15) | ||
}); | ||
},{"./helper/makeString":20}]},{},[25]); |
@@ -1,3 +0,19 @@ | ||
/* underscore.string 3.2.2 | MIT licensed | http://epeli.github.com/underscore.string/ */ | ||
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.s=e()}}(function(){return function e(r,t,n){function i(o,p){if(!t[o]){if(!r[o]){var u="function"==typeof require&&require;if(!p&&u)return u(o,!0);if(a)return a(o,!0);throw new Error("Cannot find module '"+o+"'")}var c=t[o]={exports:{}};r[o][0].call(c.exports,function(e){var t=r[o][1][e];return i(t?t:e)},c,c.exports,e,r,t,n)}return t[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,r){var t=e("./trim"),n=e("./decapitalize");r.exports=function(e,r){return e=t(e).replace(/[-_\s]+(.)?/g,function(e,r){return r?r.toUpperCase():""}),r===!0?n(e):e}},{"./decapitalize":10,"./trim":63}],2:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r){e=t(e);var n=r?e.slice(1).toLowerCase():e.slice(1);return e.charAt(0).toUpperCase()+n}},{"./helper/makeString":21}],3:[function(e,r){var t=e("./helper/makeString");r.exports=function(e){return t(e).split("")}},{"./helper/makeString":21}],4:[function(e,r){r.exports=function(e,r){return null==e?[]:(e=String(e),r=~~r,r>0?e.match(new RegExp(".{1,"+r+"}","g")):[e])}},{}],5:[function(e,r){var t=e("./capitalize"),n=e("./camelize"),i=e("./helper/makeString");r.exports=function(e){return e=i(e),t(n(e.replace(/[\W_]/g," ")).replace(/\s/g,""))}},{"./camelize":1,"./capitalize":2,"./helper/makeString":21}],6:[function(e,r){var t=e("./trim");r.exports=function(e){return t(e).replace(/\s\s+/g," ")}},{"./trim":63}],7:[function(e,r){var t=e("./helper/makeString"),n="ąàáäâãåæăćčĉęèéëêĝĥìíïîĵłľńňòóöőôõðøśșşšŝťțţŭùúüűûñÿýçżźž",i="aaaaaaaaaccceeeeeghiiiijllnnoooooooossssstttuuuuuunyyczzz";n+=n.toUpperCase(),i+=i.toUpperCase(),i=i.split(""),n+="ß",i.push("ss"),r.exports=function(e){return t(e).replace(/.{1}/g,function(e){var r=n.indexOf(e);return-1===r?e:i[r]})}},{"./helper/makeString":21}],8:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r){return e=t(e),r=t(r),0===e.length||0===r.length?0:e.split(r).length-1}},{"./helper/makeString":21}],9:[function(e,r){var t=e("./trim");r.exports=function(e){return t(e).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()}},{"./trim":63}],10:[function(e,r){var t=e("./helper/makeString");r.exports=function(e){return e=t(e),e.charAt(0).toLowerCase()+e.slice(1)}},{"./helper/makeString":21}],11:[function(e,r){function t(e){for(var r=e.match(/^[\s\\t]*/gm),t=r[0].length,n=1;n<r.length;n++)t=Math.min(r[n].length,t);return t}var n=e("./helper/makeString");r.exports=function(e,r){e=n(e);var i,a=t(e);return 0===a?e:(i="string"==typeof r?new RegExp("^"+r,"gm"):new RegExp("^[ \\t]{"+a+"}","gm"),e.replace(i,""))}},{"./helper/makeString":21}],12:[function(e,r){var t=e("./helper/makeString"),n=e("./helper/toPositive");r.exports=function(e,r,i){return e=t(e),r=""+r,i="undefined"==typeof i?e.length-r.length:Math.min(n(i),e.length)-r.length,i>=0&&e.indexOf(r,i)===i}},{"./helper/makeString":21,"./helper/toPositive":23}],13:[function(e,r){var t=e("./helper/makeString"),n=e("./helper/escapeChars"),i="[";for(var a in n)i+=a;i+="]";var o=new RegExp(i,"g");r.exports=function(e){return t(e).replace(o,function(e){return"&"+n[e]+";"})}},{"./helper/escapeChars":18,"./helper/makeString":21}],14:[function(e,r){r.exports=function(){var e={};for(var r in this)this.hasOwnProperty(r)&&!r.match(/^(?:include|contains|reverse|join|map)$/)&&(e[r]=this[r]);return e}},{}],15:[function(e,r){"use strict";function t(e){return this instanceof t?void(this._wrapped=e):new t(e)}function n(e,r){"function"==typeof r&&(t.prototype[e]=function(){var e=[this._wrapped].concat(Array.prototype.slice.call(arguments)),n=r.apply(null,e);return"string"==typeof n?new t(n):n})}function i(e){n(e,function(r){var t=Array.prototype.slice.call(arguments,1);return String.prototype[e].apply(r,t)})}t.VERSION="3.2.2",t.isBlank=e("./isBlank"),t.stripTags=e("./stripTags"),t.capitalize=e("./capitalize"),t.decapitalize=e("./decapitalize"),t.chop=e("./chop"),t.trim=e("./trim"),t.clean=e("./clean"),t.cleanDiacritics=e("./cleanDiacritics"),t.count=e("./count"),t.chars=e("./chars"),t.swapCase=e("./swapCase"),t.escapeHTML=e("./escapeHTML"),t.unescapeHTML=e("./unescapeHTML"),t.splice=e("./splice"),t.insert=e("./insert"),t.replaceAll=e("./replaceAll"),t.include=e("./include"),t.join=e("./join"),t.lines=e("./lines"),t.dedent=e("./dedent"),t.reverse=e("./reverse"),t.startsWith=e("./startsWith"),t.endsWith=e("./endsWith"),t.pred=e("./pred"),t.succ=e("./succ"),t.titleize=e("./titleize"),t.camelize=e("./camelize"),t.underscored=e("./underscored"),t.dasherize=e("./dasherize"),t.classify=e("./classify"),t.humanize=e("./humanize"),t.ltrim=e("./ltrim"),t.rtrim=e("./rtrim"),t.truncate=e("./truncate"),t.prune=e("./prune"),t.words=e("./words"),t.pad=e("./pad"),t.lpad=e("./lpad"),t.rpad=e("./rpad"),t.lrpad=e("./lrpad"),t.sprintf=e("./sprintf"),t.vsprintf=e("./vsprintf"),t.toNumber=e("./toNumber"),t.numberFormat=e("./numberFormat"),t.strRight=e("./strRight"),t.strRightBack=e("./strRightBack"),t.strLeft=e("./strLeft"),t.strLeftBack=e("./strLeftBack"),t.toSentence=e("./toSentence"),t.toSentenceSerial=e("./toSentenceSerial"),t.slugify=e("./slugify"),t.surround=e("./surround"),t.quote=e("./quote"),t.unquote=e("./unquote"),t.repeat=e("./repeat"),t.naturalCmp=e("./naturalCmp"),t.levenshtein=e("./levenshtein"),t.toBoolean=e("./toBoolean"),t.exports=e("./exports"),t.escapeRegExp=e("./helper/escapeRegExp"),t.wrap=e("./wrap"),t.map=e("./map"),t.strip=t.trim,t.lstrip=t.ltrim,t.rstrip=t.rtrim,t.center=t.lrpad,t.rjust=t.lpad,t.ljust=t.rpad,t.contains=t.include,t.q=t.quote,t.toBool=t.toBoolean,t.camelcase=t.camelize,t.mapChars=t.map,t.prototype={value:function(){return this._wrapped}};for(var a in t)n(a,t[a]);n("tap",function(e,r){return r(e)});var o=["toUpperCase","toLowerCase","split","replace","slice","substring","substr","concat"];for(var p in o)i(o[p]);r.exports=t},{"./camelize":1,"./capitalize":2,"./chars":3,"./chop":4,"./classify":5,"./clean":6,"./cleanDiacritics":7,"./count":8,"./dasherize":9,"./decapitalize":10,"./dedent":11,"./endsWith":12,"./escapeHTML":13,"./exports":14,"./helper/escapeRegExp":19,"./humanize":24,"./include":25,"./insert":26,"./isBlank":27,"./join":28,"./levenshtein":29,"./lines":30,"./lpad":31,"./lrpad":32,"./ltrim":33,"./map":34,"./naturalCmp":35,"./numberFormat":36,"./pad":37,"./pred":38,"./prune":39,"./quote":40,"./repeat":41,"./replaceAll":42,"./reverse":43,"./rpad":44,"./rtrim":45,"./slugify":46,"./splice":47,"./sprintf":48,"./startsWith":49,"./strLeft":50,"./strLeftBack":51,"./strRight":52,"./strRightBack":53,"./stripTags":54,"./succ":55,"./surround":56,"./swapCase":57,"./titleize":58,"./toBoolean":59,"./toNumber":60,"./toSentence":61,"./toSentenceSerial":62,"./trim":63,"./truncate":64,"./underscored":65,"./unescapeHTML":66,"./unquote":67,"./vsprintf":68,"./words":69,"./wrap":70}],16:[function(e,r){var t=e("./makeString");r.exports=function(e,r){return e=t(e),0===e.length?"":e.slice(0,-1)+String.fromCharCode(e.charCodeAt(e.length-1)+r)}},{"./makeString":21}],17:[function(e,r){var t=e("./escapeRegExp");r.exports=function(e){return null==e?"\\s":e.source?e.source:"["+t(e)+"]"}},{"./escapeRegExp":19}],18:[function(e,r){var t={"¢":"cent","£":"pound","¥":"yen","€":"euro","©":"copy","®":"reg","<":"lt",">":"gt",'"':"quot","&":"amp","'":"#39"};r.exports=t},{}],19:[function(e,r){var t=e("./makeString");r.exports=function(e){return t(e).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}},{"./makeString":21}],20:[function(e,r){var t={nbsp:" ",cent:"¢",pound:"£",yen:"¥",euro:"€",copy:"©",reg:"®",lt:"<",gt:">",quot:'"',amp:"&",apos:"'"};r.exports=t},{}],21:[function(e,r){r.exports=function(e){return null==e?"":""+e}},{}],22:[function(e,r){r.exports=function(e,r){if(1>r)return"";for(var t="";r>0;)1&r&&(t+=e),r>>=1,e+=e;return t}},{}],23:[function(e,r){r.exports=function(e){return 0>e?0:+e||0}},{}],24:[function(e,r){var t=e("./capitalize"),n=e("./underscored"),i=e("./trim");r.exports=function(e){return t(i(n(e).replace(/_id$/,"").replace(/_/g," ")))}},{"./capitalize":2,"./trim":63,"./underscored":65}],25:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r){return""===r?!0:-1!==t(e).indexOf(r)}},{"./helper/makeString":21}],26:[function(e,r){var t=e("./splice");r.exports=function(e,r,n){return t(e,r,0,n)}},{"./splice":47}],27:[function(e,r){var t=e("./helper/makeString");r.exports=function(e){return/^\s*$/.test(t(e))}},{"./helper/makeString":21}],28:[function(e,r){var t=e("./helper/makeString"),n=[].slice;r.exports=function(){var e=n.call(arguments),r=e.shift();return e.join(t(r))}},{"./helper/makeString":21}],29:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r){"use strict";if(e=t(e),r=t(r),e===r)return 0;if(!e||!r)return Math.max(e.length,r.length);for(var n=new Array(r.length+1),i=0;i<n.length;++i)n[i]=i;for(i=0;i<e.length;++i){for(var a=i+1,o=0;o<r.length;++o){var p=a;a=n[o]+(e.charAt(i)===r.charAt(o)?0:1);var u=p+1;a>u&&(a=u),u=n[o+1]+1,a>u&&(a=u),n[o]=p}n[o]=a}return a}},{"./helper/makeString":21}],30:[function(e,r){r.exports=function(e){return null==e?[]:String(e).split(/\r\n?|\n/)}},{}],31:[function(e,r){var t=e("./pad");r.exports=function(e,r,n){return t(e,r,n)}},{"./pad":37}],32:[function(e,r){var t=e("./pad");r.exports=function(e,r,n){return t(e,r,n,"both")}},{"./pad":37}],33:[function(e,r){var t=e("./helper/makeString"),n=e("./helper/defaultToWhiteSpace"),i=String.prototype.trimLeft;r.exports=function(e,r){return e=t(e),!r&&i?i.call(e):(r=n(r),e.replace(new RegExp("^"+r+"+"),""))}},{"./helper/defaultToWhiteSpace":17,"./helper/makeString":21}],34:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r){return e=t(e),0===e.length||"function"!=typeof r?e:e.replace(/./g,r)}},{"./helper/makeString":21}],35:[function(e,r){r.exports=function(e,r){if(e==r)return 0;if(!e)return-1;if(!r)return 1;for(var t=/(\.\d+|\d+|\D+)/g,n=String(e).match(t),i=String(r).match(t),a=Math.min(n.length,i.length),o=0;a>o;o++){var p=n[o],u=i[o];if(p!==u){var c=+p,s=+u;return c===c&&s===s?c>s?1:-1:u>p?-1:1}}return n.length!=i.length?n.length-i.length:r>e?-1:1}},{}],36:[function(e,r){r.exports=function(e,r,t,n){if(isNaN(e)||null==e)return"";e=e.toFixed(~~r),n="string"==typeof n?n:",";var i=e.split("."),a=i[0],o=i[1]?(t||".")+i[1]:"";return a.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+n)+o}},{}],37:[function(e,r){var t=e("./helper/makeString"),n=e("./helper/strRepeat");r.exports=function(e,r,i,a){e=t(e),r=~~r;var o=0;switch(i?i.length>1&&(i=i.charAt(0)):i=" ",a){case"right":return o=r-e.length,e+n(i,o);case"both":return o=r-e.length,n(i,Math.ceil(o/2))+e+n(i,Math.floor(o/2));default:return o=r-e.length,n(i,o)+e}}},{"./helper/makeString":21,"./helper/strRepeat":22}],38:[function(e,r){var t=e("./helper/adjacent");r.exports=function(e){return t(e,-1)}},{"./helper/adjacent":16}],39:[function(e,r){var t=e("./helper/makeString"),n=e("./rtrim");r.exports=function(e,r,i){if(e=t(e),r=~~r,i=null!=i?String(i):"...",e.length<=r)return e;var a=function(e){return e.toUpperCase()!==e.toLowerCase()?"A":" "},o=e.slice(0,r+1).replace(/.(?=\W*\w*$)/g,a);return o=o.slice(o.length-2).match(/\w\w/)?o.replace(/\s*\S+$/,""):n(o.slice(0,o.length-1)),(o+i).length>e.length?e:e.slice(0,o.length)+i}},{"./helper/makeString":21,"./rtrim":45}],40:[function(e,r){var t=e("./surround");r.exports=function(e,r){return t(e,r||'"')}},{"./surround":56}],41:[function(e,r){var t=e("./helper/makeString"),n=e("./helper/strRepeat");r.exports=function i(e,r,a){if(e=t(e),r=~~r,null==a)return n(e,r);for(var i=[];r>0;i[--r]=e);return i.join(a)}},{"./helper/makeString":21,"./helper/strRepeat":22}],42:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r,n,i){var a=i===!0?"gi":"g",o=new RegExp(r,a);return t(e).replace(o,n)}},{"./helper/makeString":21}],43:[function(e,r){var t=e("./chars");r.exports=function(e){return t(e).reverse().join("")}},{"./chars":3}],44:[function(e,r){var t=e("./pad");r.exports=function(e,r,n){return t(e,r,n,"right")}},{"./pad":37}],45:[function(e,r){var t=e("./helper/makeString"),n=e("./helper/defaultToWhiteSpace"),i=String.prototype.trimRight;r.exports=function(e,r){return e=t(e),!r&&i?i.call(e):(r=n(r),e.replace(new RegExp(r+"+$"),""))}},{"./helper/defaultToWhiteSpace":17,"./helper/makeString":21}],46:[function(e,r){var t=e("./trim"),n=e("./dasherize"),i=e("./cleanDiacritics");r.exports=function(e){return t(n(i(e).replace(/[^\w\s-]/g,"-").toLowerCase()),"-")}},{"./cleanDiacritics":7,"./dasherize":9,"./trim":63}],47:[function(e,r){var t=e("./chars");r.exports=function(e,r,n,i){var a=t(e);return a.splice(~~r,~~n,i),a.join("")}},{"./chars":3}],48:[function(e,r){var t=e("./helper/strRepeat"),n=Object.prototype.toString,i=function(){function e(e){return n.call(e).slice(8,-1).toLowerCase()}var r=t,a=function(){return a.cache.hasOwnProperty(arguments[0])||(a.cache[arguments[0]]=a.parse(arguments[0])),a.format.call(null,a.cache[arguments[0]],arguments)};return a.format=function(t,n){var a,o,p,u,c,s,l,f=1,h=t.length,g="",m=[];for(o=0;h>o;o++)if(g=e(t[o]),"string"===g)m.push(t[o]);else if("array"===g){if(u=t[o],u[2])for(a=n[f],p=0;p<u[2].length;p++){if(!a.hasOwnProperty(u[2][p]))throw new Error(i('[_.sprintf] property "%s" does not exist',u[2][p]));a=a[u[2][p]]}else a=u[1]?n[u[1]]:n[f++];if(/[^s]/.test(u[8])&&"number"!=e(a))throw new Error(i("[_.sprintf] expecting number but found %s",e(a)));switch(u[8]){case"b":a=a.toString(2);break;case"c":a=String.fromCharCode(a);break;case"d":a=parseInt(a,10);break;case"e":a=u[7]?a.toExponential(u[7]):a.toExponential();break;case"f":a=u[7]?parseFloat(a).toFixed(u[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=(a=String(a))&&u[7]?a.substring(0,u[7]):a;break;case"u":a=Math.abs(a);break;case"x":a=a.toString(16);break;case"X":a=a.toString(16).toUpperCase()}a=/[def]/.test(u[8])&&u[3]&&a>=0?"+"+a:a,s=u[4]?"0"==u[4]?"0":u[4].charAt(1):" ",l=u[6]-String(a).length,c=u[6]?r(s,l):"",m.push(u[5]?a+c:c+a)}return m.join("")},a.cache={},a.parse=function(e){for(var r=e,t=[],n=[],i=0;r;){if(null!==(t=/^[^\x25]+/.exec(r)))n.push(t[0]);else if(null!==(t=/^\x25{2}/.exec(r)))n.push("%");else{if(null===(t=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(r)))throw new Error("[_.sprintf] huh?");if(t[2]){i|=1;var a=[],o=t[2],p=[];if(null===(p=/^([a-z_][a-z_\d]*)/i.exec(o)))throw new Error("[_.sprintf] huh?");for(a.push(p[1]);""!==(o=o.substring(p[0].length));)if(null!==(p=/^\.([a-z_][a-z_\d]*)/i.exec(o)))a.push(p[1]);else{if(null===(p=/^\[(\d+)\]/.exec(o)))throw new Error("[_.sprintf] huh?");a.push(p[1])}t[2]=a}else i|=2;if(3===i)throw new Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");n.push(t)}r=r.substring(t[0].length)}return n},a}();r.exports=i},{"./helper/strRepeat":22}],49:[function(e,r){var t=e("./helper/makeString"),n=e("./helper/toPositive");r.exports=function(e,r,i){return e=t(e),r=""+r,i=null==i?0:Math.min(n(i),e.length),e.lastIndexOf(r,i)===i}},{"./helper/makeString":21,"./helper/toPositive":23}],50:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r){e=t(e),r=t(r);var n=r?e.indexOf(r):-1;return~n?e.slice(0,n):e}},{"./helper/makeString":21}],51:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r){e=t(e),r=t(r);var n=e.lastIndexOf(r);return~n?e.slice(0,n):e}},{"./helper/makeString":21}],52:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r){e=t(e),r=t(r);var n=r?e.indexOf(r):-1;return~n?e.slice(n+r.length,e.length):e}},{"./helper/makeString":21}],53:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r){e=t(e),r=t(r);var n=r?e.lastIndexOf(r):-1;return~n?e.slice(n+r.length,e.length):e}},{"./helper/makeString":21}],54:[function(e,r){var t=e("./helper/makeString");r.exports=function(e){return t(e).replace(/<\/?[^>]+>/g,"")}},{"./helper/makeString":21}],55:[function(e,r){var t=e("./helper/adjacent");r.exports=function(e){return t(e,1)}},{"./helper/adjacent":16}],56:[function(e,r){r.exports=function(e,r){return[r,e,r].join("")}},{}],57:[function(e,r){var t=e("./helper/makeString");r.exports=function(e){return t(e).replace(/\S/g,function(e){return e===e.toUpperCase()?e.toLowerCase():e.toUpperCase()})}},{"./helper/makeString":21}],58:[function(e,r){var t=e("./helper/makeString");r.exports=function(e){return t(e).toLowerCase().replace(/(?:^|\s|-)\S/g,function(e){return e.toUpperCase()})}},{"./helper/makeString":21}],59:[function(e,r){function t(e,r){var t,n,i=e.toLowerCase();for(r=[].concat(r),t=0;t<r.length;t+=1)if(n=r[t]){if(n.test&&n.test(e))return!0;if(n.toLowerCase()===i)return!0}}var n=e("./trim");r.exports=function(e,r,i){return"number"==typeof e&&(e=""+e),"string"!=typeof e?!!e:(e=n(e),t(e,r||["true","1"])?!0:t(e,i||["false","0"])?!1:void 0)}},{"./trim":63}],60:[function(e,r){r.exports=function(e,r){if(null==e)return 0;var t=Math.pow(10,isFinite(r)?r:0);return Math.round(e*t)/t}},{}],61:[function(e,r){var t=e("./rtrim");r.exports=function(e,r,n,i){r=r||", ",n=n||" and ";var a=e.slice(),o=a.pop();return e.length>2&&i&&(n=t(r)+n),a.length?a.join(r)+n+o:o}},{"./rtrim":45}],62:[function(e,r){var t=e("./toSentence");r.exports=function(e,r,n){return t(e,r,n,!0)}},{"./toSentence":61}],63:[function(e,r){var t=e("./helper/makeString"),n=e("./helper/defaultToWhiteSpace"),i=String.prototype.trim;r.exports=function(e,r){return e=t(e),!r&&i?i.call(e):(r=n(r),e.replace(new RegExp("^"+r+"+|"+r+"+$","g"),""))}},{"./helper/defaultToWhiteSpace":17,"./helper/makeString":21}],64:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r,n){return e=t(e),n=n||"...",r=~~r,e.length>r?e.slice(0,r)+n:e}},{"./helper/makeString":21}],65:[function(e,r){var t=e("./trim");r.exports=function(e){return t(e).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}},{"./trim":63}],66:[function(e,r){var t=e("./helper/makeString"),n=e("./helper/htmlEntities");r.exports=function(e){return t(e).replace(/\&([^;]+);/g,function(e,r){var t;return r in n?n[r]:(t=r.match(/^#x([\da-fA-F]+)$/))?String.fromCharCode(parseInt(t[1],16)):(t=r.match(/^#(\d+)$/))?String.fromCharCode(~~t[1]):e})}},{"./helper/htmlEntities":20,"./helper/makeString":21}],67:[function(e,r){r.exports=function(e,r){return r=r||'"',e[0]===r&&e[e.length-1]===r?e.slice(1,e.length-1):e}},{}],68:[function(e,r){var t=e("./sprintf");r.exports=function(e,r){return r.unshift(e),t.apply(null,r)}},{"./sprintf":48}],69:[function(e,r){var t=e("./isBlank"),n=e("./trim");r.exports=function(e,r){return t(e)?[]:n(e,r).split(r||/\s+/)}},{"./isBlank":27,"./trim":63}],70:[function(e,r){var t=e("./helper/makeString");r.exports=function(e,r){e=t(e),r=r||{};var n,i=r.width||75,a=r.seperator||"\n",o=r.cut||!1,p=r.preserveSpaces||!1,u=r.trailingSpaces||!1;if(0>=i)return e;if(o){var c=0;for(n="";c<e.length;)c%i==0&&c>0&&(n+=a),n+=e.charAt(c),c++;if(u)for(;c%i>0;)n+=" ",c++;return n}var s=e.split(" "),l=0;for(n="";s.length>0;){if(1+s[0].length+l>i&&l>0){if(p)n+=" ",l++;else if(u)for(;i>l;)n+=" ",l++;n+=a,l=0}l>0&&(n+=" ",l++),n+=s[0],l+=s[0].length,s.shift()}if(u)for(;i>l;)n+=" ",l++;return n}},{"./helper/makeString":21}]},{},[15])(15)}); | ||
/* | ||
* Underscore.string | ||
* (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org> | ||
* Underscore.string is freely distributable under the terms of the MIT license. | ||
* Documentation: https://github.com/epeli/underscore.string | ||
* Some code is borrowed from MooTools and Alexandru Marasteanu. | ||
* Version '3.3.0' | ||
* @preserve | ||
*/ | ||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var trim=require("./trim");var decap=require("./decapitalize");module.exports=function camelize(str,decapitalize){str=trim(str).replace(/[-_\s]+(.)?/g,function(match,c){return c?c.toUpperCase():""});if(decapitalize===true){return decap(str)}else{return str}}},{"./decapitalize":10,"./trim":65}],2:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function capitalize(str,lowercaseRest){str=makeString(str);var remainingChars=!lowercaseRest?str.slice(1):str.slice(1).toLowerCase();return str.charAt(0).toUpperCase()+remainingChars}},{"./helper/makeString":20}],3:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function chars(str){return makeString(str).split("")}},{"./helper/makeString":20}],4:[function(require,module,exports){module.exports=function chop(str,step){if(str==null)return[];str=String(str);step=~~step;return step>0?str.match(new RegExp(".{1,"+step+"}","g")):[str]}},{}],5:[function(require,module,exports){var capitalize=require("./capitalize");var camelize=require("./camelize");var makeString=require("./helper/makeString");module.exports=function classify(str){str=makeString(str);return capitalize(camelize(str.replace(/[\W_]/g," ")).replace(/\s/g,""))}},{"./camelize":1,"./capitalize":2,"./helper/makeString":20}],6:[function(require,module,exports){var trim=require("./trim");module.exports=function clean(str){return trim(str).replace(/\s\s+/g," ")}},{"./trim":65}],7:[function(require,module,exports){var makeString=require("./helper/makeString");var from="ąàáäâãåæăćčĉęèéëêĝĥìíïîĵłľńňòóöőôõðøśșşšŝťțţŭùúüűûñÿýçżźž",to="aaaaaaaaaccceeeeeghiiiijllnnoooooooossssstttuuuuuunyyczzz";from+=from.toUpperCase();to+=to.toUpperCase();to=to.split("");from+="ß";to.push("ss");module.exports=function cleanDiacritics(str){return makeString(str).replace(/.{1}/g,function(c){var index=from.indexOf(c);return index===-1?c:to[index]})}},{"./helper/makeString":20}],8:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function(str,substr){str=makeString(str);substr=makeString(substr);if(str.length===0||substr.length===0)return 0;return str.split(substr).length-1}},{"./helper/makeString":20}],9:[function(require,module,exports){var trim=require("./trim");module.exports=function dasherize(str){return trim(str).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()}},{"./trim":65}],10:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function decapitalize(str){str=makeString(str);return str.charAt(0).toLowerCase()+str.slice(1)}},{"./helper/makeString":20}],11:[function(require,module,exports){var makeString=require("./helper/makeString");function getIndent(str){var matches=str.match(/^[\s\\t]*/gm);var indent=matches[0].length;for(var i=1;i<matches.length;i++){indent=Math.min(matches[i].length,indent)}return indent}module.exports=function dedent(str,pattern){str=makeString(str);var indent=getIndent(str);var reg;if(indent===0)return str;if(typeof pattern==="string"){reg=new RegExp("^"+pattern,"gm")}else{reg=new RegExp("^[ \\t]{"+indent+"}","gm")}return str.replace(reg,"")}},{"./helper/makeString":20}],12:[function(require,module,exports){var makeString=require("./helper/makeString");var toPositive=require("./helper/toPositive");module.exports=function endsWith(str,ends,position){str=makeString(str);ends=""+ends;if(typeof position=="undefined"){position=str.length-ends.length}else{position=Math.min(toPositive(position),str.length)-ends.length}return position>=0&&str.indexOf(ends,position)===position}},{"./helper/makeString":20,"./helper/toPositive":22}],13:[function(require,module,exports){var makeString=require("./helper/makeString");var escapeChars=require("./helper/escapeChars");var regexString="[";for(var key in escapeChars){regexString+=key}regexString+="]";var regex=new RegExp(regexString,"g");module.exports=function escapeHTML(str){return makeString(str).replace(regex,function(m){return"&"+escapeChars[m]+";"})}},{"./helper/escapeChars":17,"./helper/makeString":20}],14:[function(require,module,exports){module.exports=function(){var result={};for(var prop in this){if(!this.hasOwnProperty(prop)||prop.match(/^(?:include|contains|reverse|join|map|wrap)$/))continue;result[prop]=this[prop]}return result}},{}],15:[function(require,module,exports){var makeString=require("./makeString");module.exports=function adjacent(str,direction){str=makeString(str);if(str.length===0){return""}return str.slice(0,-1)+String.fromCharCode(str.charCodeAt(str.length-1)+direction)}},{"./makeString":20}],16:[function(require,module,exports){var escapeRegExp=require("./escapeRegExp");module.exports=function defaultToWhiteSpace(characters){if(characters==null)return"\\s";else if(characters.source)return characters.source;else return"["+escapeRegExp(characters)+"]"}},{"./escapeRegExp":18}],17:[function(require,module,exports){var escapeChars={"¢":"cent","£":"pound","¥":"yen","€":"euro","©":"copy","®":"reg","<":"lt",">":"gt",'"':"quot","&":"amp","'":"#39"};module.exports=escapeChars},{}],18:[function(require,module,exports){var makeString=require("./makeString");module.exports=function escapeRegExp(str){return makeString(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}},{"./makeString":20}],19:[function(require,module,exports){var htmlEntities={nbsp:" ",cent:"¢",pound:"£",yen:"¥",euro:"€",copy:"©",reg:"®",lt:"<",gt:">",quot:'"',amp:"&",apos:"'"};module.exports=htmlEntities},{}],20:[function(require,module,exports){module.exports=function makeString(object){if(object==null)return"";return""+object}},{}],21:[function(require,module,exports){module.exports=function strRepeat(str,qty){if(qty<1)return"";var result="";while(qty>0){if(qty&1)result+=str;qty>>=1,str+=str}return result}},{}],22:[function(require,module,exports){module.exports=function toPositive(number){return number<0?0:+number||0}},{}],23:[function(require,module,exports){var capitalize=require("./capitalize");var underscored=require("./underscored");var trim=require("./trim");module.exports=function humanize(str){return capitalize(trim(underscored(str).replace(/_id$/,"").replace(/_/g," ")))}},{"./capitalize":2,"./trim":65,"./underscored":67}],24:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function include(str,needle){if(needle==="")return true;return makeString(str).indexOf(needle)!==-1}},{"./helper/makeString":20}],25:[function(require,module,exports){/* | ||
* Underscore.string | ||
* (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org> | ||
* Underscore.string is freely distributable under the terms of the MIT license. | ||
* Documentation: https://github.com/epeli/underscore.string | ||
* Some code is borrowed from MooTools and Alexandru Marasteanu. | ||
* Version '3.3.0' | ||
* @preserve | ||
*/ | ||
"use strict";function s(value){if(!(this instanceof s))return new s(value);this._wrapped=value}s.VERSION="3.3.0";s.isBlank=require("./isBlank");s.stripTags=require("./stripTags");s.capitalize=require("./capitalize");s.decapitalize=require("./decapitalize");s.chop=require("./chop");s.trim=require("./trim");s.clean=require("./clean");s.cleanDiacritics=require("./cleanDiacritics");s.count=require("./count");s.chars=require("./chars");s.swapCase=require("./swapCase");s.escapeHTML=require("./escapeHTML");s.unescapeHTML=require("./unescapeHTML");s.splice=require("./splice");s.insert=require("./insert");s.replaceAll=require("./replaceAll");s.include=require("./include");s.join=require("./join");s.lines=require("./lines");s.dedent=require("./dedent");s.reverse=require("./reverse");s.startsWith=require("./startsWith");s.endsWith=require("./endsWith");s.pred=require("./pred");s.succ=require("./succ");s.titleize=require("./titleize");s.camelize=require("./camelize");s.underscored=require("./underscored");s.dasherize=require("./dasherize");s.classify=require("./classify");s.humanize=require("./humanize");s.ltrim=require("./ltrim");s.rtrim=require("./rtrim");s.truncate=require("./truncate");s.prune=require("./prune");s.words=require("./words");s.pad=require("./pad");s.lpad=require("./lpad");s.rpad=require("./rpad");s.lrpad=require("./lrpad");s.sprintf=require("./sprintf");s.vsprintf=require("./vsprintf");s.toNumber=require("./toNumber");s.numberFormat=require("./numberFormat");s.strRight=require("./strRight");s.strRightBack=require("./strRightBack");s.strLeft=require("./strLeft");s.strLeftBack=require("./strLeftBack");s.toSentence=require("./toSentence");s.toSentenceSerial=require("./toSentenceSerial");s.slugify=require("./slugify");s.surround=require("./surround");s.quote=require("./quote");s.unquote=require("./unquote");s.repeat=require("./repeat");s.naturalCmp=require("./naturalCmp");s.levenshtein=require("./levenshtein");s.toBoolean=require("./toBoolean");s.exports=require("./exports");s.escapeRegExp=require("./helper/escapeRegExp");s.wrap=require("./wrap");s.map=require("./map");s.strip=s.trim;s.lstrip=s.ltrim;s.rstrip=s.rtrim;s.center=s.lrpad;s.rjust=s.lpad;s.ljust=s.rpad;s.contains=s.include;s.q=s.quote;s.toBool=s.toBoolean;s.camelcase=s.camelize;s.mapChars=s.map;s.prototype={value:function value(){return this._wrapped}};function fn2method(key,fn){if(typeof fn!=="function")return;s.prototype[key]=function(){var args=[this._wrapped].concat(Array.prototype.slice.call(arguments));var res=fn.apply(null,args);return typeof res==="string"?new s(res):res}}for(var key in s)fn2method(key,s[key]);fn2method("tap",function tap(string,fn){return fn(string)});function prototype2method(methodName){fn2method(methodName,function(context){var args=Array.prototype.slice.call(arguments,1);return String.prototype[methodName].apply(context,args)})}var prototypeMethods=["toUpperCase","toLowerCase","split","replace","slice","substring","substr","concat"];for(var method in prototypeMethods)prototype2method(prototypeMethods[method]);module.exports=s},{"./camelize":1,"./capitalize":2,"./chars":3,"./chop":4,"./classify":5,"./clean":6,"./cleanDiacritics":7,"./count":8,"./dasherize":9,"./decapitalize":10,"./dedent":11,"./endsWith":12,"./escapeHTML":13,"./exports":14,"./helper/escapeRegExp":18,"./humanize":23,"./include":24,"./insert":26,"./isBlank":27,"./join":28,"./levenshtein":29,"./lines":30,"./lpad":31,"./lrpad":32,"./ltrim":33,"./map":34,"./naturalCmp":35,"./numberFormat":38,"./pad":39,"./pred":40,"./prune":41,"./quote":42,"./repeat":43,"./replaceAll":44,"./reverse":45,"./rpad":46,"./rtrim":47,"./slugify":48,"./splice":49,"./sprintf":50,"./startsWith":51,"./strLeft":52,"./strLeftBack":53,"./strRight":54,"./strRightBack":55,"./stripTags":56,"./succ":57,"./surround":58,"./swapCase":59,"./titleize":60,"./toBoolean":61,"./toNumber":62,"./toSentence":63,"./toSentenceSerial":64,"./trim":65,"./truncate":66,"./underscored":67,"./unescapeHTML":68,"./unquote":69,"./vsprintf":70,"./words":71,"./wrap":72}],26:[function(require,module,exports){var splice=require("./splice");module.exports=function insert(str,i,substr){return splice(str,i,0,substr)}},{"./splice":49}],27:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function isBlank(str){return/^\s*$/.test(makeString(str))}},{"./helper/makeString":20}],28:[function(require,module,exports){var makeString=require("./helper/makeString");var slice=[].slice;module.exports=function join(){var args=slice.call(arguments),separator=args.shift();return args.join(makeString(separator))}},{"./helper/makeString":20}],29:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function levenshtein(str1,str2){"use strict";str1=makeString(str1);str2=makeString(str2);if(str1===str2)return 0;if(!str1||!str2)return Math.max(str1.length,str2.length);var prevRow=new Array(str2.length+1);for(var i=0;i<prevRow.length;++i){prevRow[i]=i}for(i=0;i<str1.length;++i){var nextCol=i+1;for(var j=0;j<str2.length;++j){var curCol=nextCol;nextCol=prevRow[j]+(str1.charAt(i)===str2.charAt(j)?0:1);var tmp=curCol+1;if(nextCol>tmp){nextCol=tmp}tmp=prevRow[j+1]+1;if(nextCol>tmp){nextCol=tmp}prevRow[j]=curCol}prevRow[j]=nextCol}return nextCol}},{"./helper/makeString":20}],30:[function(require,module,exports){module.exports=function lines(str){if(str==null)return[];return String(str).split(/\r\n?|\n/)}},{}],31:[function(require,module,exports){var pad=require("./pad");module.exports=function lpad(str,length,padStr){return pad(str,length,padStr)}},{"./pad":39}],32:[function(require,module,exports){var pad=require("./pad");module.exports=function lrpad(str,length,padStr){return pad(str,length,padStr,"both")}},{"./pad":39}],33:[function(require,module,exports){var makeString=require("./helper/makeString");var defaultToWhiteSpace=require("./helper/defaultToWhiteSpace");var nativeTrimLeft=String.prototype.trimLeft;module.exports=function ltrim(str,characters){str=makeString(str);if(!characters&&nativeTrimLeft)return nativeTrimLeft.call(str);characters=defaultToWhiteSpace(characters);return str.replace(new RegExp("^"+characters+"+"),"")}},{"./helper/defaultToWhiteSpace":16,"./helper/makeString":20}],34:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function(str,callback){str=makeString(str);if(str.length===0||typeof callback!=="function")return str;return str.replace(/./g,callback)}},{"./helper/makeString":20}],35:[function(require,module,exports){module.exports=function naturalCmp(str1,str2){if(str1==str2)return 0;if(!str1)return-1;if(!str2)return 1;var cmpRegex=/(\.\d+|\d+|\D+)/g,tokens1=String(str1).match(cmpRegex),tokens2=String(str2).match(cmpRegex),count=Math.min(tokens1.length,tokens2.length);for(var i=0;i<count;i++){var a=tokens1[i],b=tokens2[i];if(a!==b){var num1=+a;var num2=+b;if(num1===num1&&num2===num2){return num1>num2?1:-1}return a<b?-1:1}}if(tokens1.length!=tokens2.length)return tokens1.length-tokens2.length;return str1<str2?-1:1}},{}],36:[function(require,module,exports){(function(window){var re={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};function sprintf(){var key=arguments[0],cache=sprintf.cache;if(!(cache[key]&&cache.hasOwnProperty(key))){cache[key]=sprintf.parse(key)}return sprintf.format.call(null,cache[key],arguments)}sprintf.format=function(parse_tree,argv){var cursor=1,tree_length=parse_tree.length,node_type="",arg,output=[],i,k,match,pad,pad_character,pad_length,is_positive=true,sign="";for(i=0;i<tree_length;i++){node_type=get_type(parse_tree[i]);if(node_type==="string"){output[output.length]=parse_tree[i]}else if(node_type==="array"){match=parse_tree[i];if(match[2]){arg=argv[cursor];for(k=0;k<match[2].length;k++){if(!arg.hasOwnProperty(match[2][k])){throw new Error(sprintf("[sprintf] property '%s' does not exist",match[2][k]))}arg=arg[match[2][k]]}}else if(match[1]){arg=argv[match[1]]}else{arg=argv[cursor++]}if(get_type(arg)=="function"){arg=arg()}if(re.not_string.test(match[8])&&re.not_json.test(match[8])&&(get_type(arg)!="number"&&isNaN(arg))){throw new TypeError(sprintf("[sprintf] expecting number but found %s",get_type(arg)))}if(re.number.test(match[8])){is_positive=arg>=0}switch(match[8]){case"b":arg=arg.toString(2);break;case"c":arg=String.fromCharCode(arg);break;case"d":case"i":arg=parseInt(arg,10);break;case"j":arg=JSON.stringify(arg,null,match[6]?parseInt(match[6]):0);break;case"e":arg=match[7]?arg.toExponential(match[7]):arg.toExponential();break;case"f":arg=match[7]?parseFloat(arg).toFixed(match[7]):parseFloat(arg);break;case"g":arg=match[7]?parseFloat(arg).toPrecision(match[7]):parseFloat(arg);break;case"o":arg=arg.toString(8);break;case"s":arg=(arg=String(arg))&&match[7]?arg.substring(0,match[7]):arg;break;case"u":arg=arg>>>0;break;case"x":arg=arg.toString(16);break;case"X":arg=arg.toString(16).toUpperCase();break}if(re.json.test(match[8])){output[output.length]=arg}else{if(re.number.test(match[8])&&(!is_positive||match[3])){sign=is_positive?"+":"-";arg=arg.toString().replace(re.sign,"")}else{sign=""}pad_character=match[4]?match[4]==="0"?"0":match[4].charAt(1):" ";pad_length=match[6]-(sign+arg).length;pad=match[6]?pad_length>0?str_repeat(pad_character,pad_length):"":"";output[output.length]=match[5]?sign+arg+pad:pad_character==="0"?sign+pad+arg:pad+sign+arg}}}return output.join("")};sprintf.cache={};sprintf.parse=function(fmt){var _fmt=fmt,match=[],parse_tree=[],arg_names=0;while(_fmt){if((match=re.text.exec(_fmt))!==null){parse_tree[parse_tree.length]=match[0]}else if((match=re.modulo.exec(_fmt))!==null){parse_tree[parse_tree.length]="%"}else if((match=re.placeholder.exec(_fmt))!==null){if(match[2]){arg_names|=1;var field_list=[],replacement_field=match[2],field_match=[];if((field_match=re.key.exec(replacement_field))!==null){field_list[field_list.length]=field_match[1];while((replacement_field=replacement_field.substring(field_match[0].length))!==""){if((field_match=re.key_access.exec(replacement_field))!==null){field_list[field_list.length]=field_match[1]}else if((field_match=re.index_access.exec(replacement_field))!==null){field_list[field_list.length]=field_match[1]}else{throw new SyntaxError("[sprintf] failed to parse named argument key")}}}else{throw new SyntaxError("[sprintf] failed to parse named argument key")}match[2]=field_list}else{arg_names|=2}if(arg_names===3){throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported")}parse_tree[parse_tree.length]=match}else{throw new SyntaxError("[sprintf] unexpected placeholder")}_fmt=_fmt.substring(match[0].length)}return parse_tree};var vsprintf=function(fmt,argv,_argv){_argv=(argv||[]).slice(0);_argv.splice(0,0,fmt);return sprintf.apply(null,_argv)};function get_type(variable){return Object.prototype.toString.call(variable).slice(8,-1).toLowerCase()}function str_repeat(input,multiplier){return Array(multiplier+1).join(input)}if(typeof exports!=="undefined"){exports.sprintf=sprintf;exports.vsprintf=vsprintf}else{window.sprintf=sprintf;window.vsprintf=vsprintf;if(typeof define==="function"&&define.amd){define(function(){return{sprintf:sprintf,vsprintf:vsprintf}})}}})(typeof window==="undefined"?this:window)},{}],37:[function(require,module,exports){(function(global){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],38:[function(require,module,exports){module.exports=function numberFormat(number,dec,dsep,tsep){if(isNaN(number)||number==null)return"";number=number.toFixed(~~dec);tsep=typeof tsep=="string"?tsep:",";var parts=number.split("."),fnums=parts[0],decimals=parts[1]?(dsep||".")+parts[1]:"";return fnums.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+tsep)+decimals}},{}],39:[function(require,module,exports){var makeString=require("./helper/makeString");var strRepeat=require("./helper/strRepeat");module.exports=function pad(str,length,padStr,type){str=makeString(str);length=~~length;var padlen=0;if(!padStr)padStr=" ";else if(padStr.length>1)padStr=padStr.charAt(0);switch(type){case"right":padlen=length-str.length;return str+strRepeat(padStr,padlen);case"both":padlen=length-str.length;return strRepeat(padStr,Math.ceil(padlen/2))+str+strRepeat(padStr,Math.floor(padlen/2));default:padlen=length-str.length;return strRepeat(padStr,padlen)+str}}},{"./helper/makeString":20,"./helper/strRepeat":21}],40:[function(require,module,exports){var adjacent=require("./helper/adjacent");module.exports=function succ(str){return adjacent(str,-1)}},{"./helper/adjacent":15}],41:[function(require,module,exports){var makeString=require("./helper/makeString");var rtrim=require("./rtrim");module.exports=function prune(str,length,pruneStr){str=makeString(str);length=~~length;pruneStr=pruneStr!=null?String(pruneStr):"...";if(str.length<=length)return str;var tmpl=function(c){return c.toUpperCase()!==c.toLowerCase()?"A":" "},template=str.slice(0,length+1).replace(/.(?=\W*\w*$)/g,tmpl);if(template.slice(template.length-2).match(/\w\w/))template=template.replace(/\s*\S+$/,"");else template=rtrim(template.slice(0,template.length-1));return(template+pruneStr).length>str.length?str:str.slice(0,template.length)+pruneStr}},{"./helper/makeString":20,"./rtrim":47}],42:[function(require,module,exports){var surround=require("./surround");module.exports=function quote(str,quoteChar){return surround(str,quoteChar||'"')}},{"./surround":58}],43:[function(require,module,exports){var makeString=require("./helper/makeString");var strRepeat=require("./helper/strRepeat");module.exports=function repeat(str,qty,separator){str=makeString(str);qty=~~qty;if(separator==null)return strRepeat(str,qty);for(var repeat=[];qty>0;repeat[--qty]=str){}return repeat.join(separator)}},{"./helper/makeString":20,"./helper/strRepeat":21}],44:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function replaceAll(str,find,replace,ignorecase){var flags=ignorecase===true?"gi":"g";var reg=new RegExp(find,flags);return makeString(str).replace(reg,replace)}},{"./helper/makeString":20}],45:[function(require,module,exports){var chars=require("./chars");module.exports=function reverse(str){return chars(str).reverse().join("")}},{"./chars":3}],46:[function(require,module,exports){var pad=require("./pad");module.exports=function rpad(str,length,padStr){return pad(str,length,padStr,"right")}},{"./pad":39}],47:[function(require,module,exports){var makeString=require("./helper/makeString");var defaultToWhiteSpace=require("./helper/defaultToWhiteSpace");var nativeTrimRight=String.prototype.trimRight;module.exports=function rtrim(str,characters){str=makeString(str);if(!characters&&nativeTrimRight)return nativeTrimRight.call(str);characters=defaultToWhiteSpace(characters);return str.replace(new RegExp(characters+"+$"),"")}},{"./helper/defaultToWhiteSpace":16,"./helper/makeString":20}],48:[function(require,module,exports){var trim=require("./trim");var dasherize=require("./dasherize");var cleanDiacritics=require("./cleanDiacritics");module.exports=function slugify(str){return trim(dasherize(cleanDiacritics(str).replace(/[^\w\s-]/g,"-").toLowerCase()),"-")}},{"./cleanDiacritics":7,"./dasherize":9,"./trim":65}],49:[function(require,module,exports){var chars=require("./chars");module.exports=function splice(str,i,howmany,substr){var arr=chars(str);arr.splice(~~i,~~howmany,substr);return arr.join("")}},{"./chars":3}],50:[function(require,module,exports){var deprecate=require("util-deprecate");module.exports=deprecate(require("sprintf-js").sprintf,"sprintf() will be removed in the next major release, use the sprintf-js package instead.")},{"sprintf-js":36,"util-deprecate":37}],51:[function(require,module,exports){var makeString=require("./helper/makeString");var toPositive=require("./helper/toPositive");module.exports=function startsWith(str,starts,position){str=makeString(str);starts=""+starts;position=position==null?0:Math.min(toPositive(position),str.length);return str.lastIndexOf(starts,position)===position}},{"./helper/makeString":20,"./helper/toPositive":22}],52:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function strLeft(str,sep){str=makeString(str);sep=makeString(sep);var pos=!sep?-1:str.indexOf(sep);return~pos?str.slice(0,pos):str}},{"./helper/makeString":20}],53:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function strLeftBack(str,sep){str=makeString(str);sep=makeString(sep);var pos=str.lastIndexOf(sep);return~pos?str.slice(0,pos):str}},{"./helper/makeString":20}],54:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function strRight(str,sep){str=makeString(str);sep=makeString(sep);var pos=!sep?-1:str.indexOf(sep);return~pos?str.slice(pos+sep.length,str.length):str}},{"./helper/makeString":20}],55:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function strRightBack(str,sep){str=makeString(str);sep=makeString(sep);var pos=!sep?-1:str.lastIndexOf(sep);return~pos?str.slice(pos+sep.length,str.length):str}},{"./helper/makeString":20}],56:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function stripTags(str){return makeString(str).replace(/<\/?[^>]+>/g,"")}},{"./helper/makeString":20}],57:[function(require,module,exports){var adjacent=require("./helper/adjacent");module.exports=function succ(str){return adjacent(str,1)}},{"./helper/adjacent":15}],58:[function(require,module,exports){module.exports=function surround(str,wrapper){return[wrapper,str,wrapper].join("")}},{}],59:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function swapCase(str){return makeString(str).replace(/\S/g,function(c){return c===c.toUpperCase()?c.toLowerCase():c.toUpperCase()})}},{"./helper/makeString":20}],60:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function titleize(str){return makeString(str).toLowerCase().replace(/(?:^|\s|-)\S/g,function(c){return c.toUpperCase()})}},{"./helper/makeString":20}],61:[function(require,module,exports){var trim=require("./trim");function boolMatch(s,matchers){var i,matcher,down=s.toLowerCase();matchers=[].concat(matchers);for(i=0;i<matchers.length;i+=1){matcher=matchers[i];if(!matcher)continue;if(matcher.test&&matcher.test(s))return true;if(matcher.toLowerCase()===down)return true}}module.exports=function toBoolean(str,trueValues,falseValues){if(typeof str==="number")str=""+str;if(typeof str!=="string")return!!str;str=trim(str);if(boolMatch(str,trueValues||["true","1"]))return true;if(boolMatch(str,falseValues||["false","0"]))return false}},{"./trim":65}],62:[function(require,module,exports){module.exports=function toNumber(num,precision){if(num==null)return 0;var factor=Math.pow(10,isFinite(precision)?precision:0);return Math.round(num*factor)/factor}},{}],63:[function(require,module,exports){var rtrim=require("./rtrim");module.exports=function toSentence(array,separator,lastSeparator,serial){separator=separator||", ";lastSeparator=lastSeparator||" and ";var a=array.slice(),lastMember=a.pop();if(array.length>2&&serial)lastSeparator=rtrim(separator)+lastSeparator;return a.length?a.join(separator)+lastSeparator+lastMember:lastMember}},{"./rtrim":47}],64:[function(require,module,exports){var toSentence=require("./toSentence");module.exports=function toSentenceSerial(array,sep,lastSep){return toSentence(array,sep,lastSep,true)}},{"./toSentence":63}],65:[function(require,module,exports){var makeString=require("./helper/makeString");var defaultToWhiteSpace=require("./helper/defaultToWhiteSpace");var nativeTrim=String.prototype.trim;module.exports=function trim(str,characters){str=makeString(str);if(!characters&&nativeTrim)return nativeTrim.call(str);characters=defaultToWhiteSpace(characters);return str.replace(new RegExp("^"+characters+"+|"+characters+"+$","g"),"")}},{"./helper/defaultToWhiteSpace":16,"./helper/makeString":20}],66:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function truncate(str,length,truncateStr){str=makeString(str);truncateStr=truncateStr||"...";length=~~length;return str.length>length?str.slice(0,length)+truncateStr:str}},{"./helper/makeString":20}],67:[function(require,module,exports){var trim=require("./trim");module.exports=function underscored(str){return trim(str).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}},{"./trim":65}],68:[function(require,module,exports){var makeString=require("./helper/makeString");var htmlEntities=require("./helper/htmlEntities");module.exports=function unescapeHTML(str){return makeString(str).replace(/\&([^;]+);/g,function(entity,entityCode){var match;if(entityCode in htmlEntities){return htmlEntities[entityCode]}else if(match=entityCode.match(/^#x([\da-fA-F]+)$/)){return String.fromCharCode(parseInt(match[1],16))}else if(match=entityCode.match(/^#(\d+)$/)){return String.fromCharCode(~~match[1])}else{return entity}})}},{"./helper/htmlEntities":19,"./helper/makeString":20}],69:[function(require,module,exports){module.exports=function unquote(str,quoteChar){quoteChar=quoteChar||'"';if(str[0]===quoteChar&&str[str.length-1]===quoteChar)return str.slice(1,str.length-1);else return str}},{}],70:[function(require,module,exports){var deprecate=require("util-deprecate");module.exports=deprecate(require("sprintf-js").vsprintf,"vsprintf() will be removed in the next major release, use the sprintf-js package instead.")},{"sprintf-js":36,"util-deprecate":37}],71:[function(require,module,exports){var isBlank=require("./isBlank");var trim=require("./trim");module.exports=function words(str,delimiter){if(isBlank(str))return[];return trim(str,delimiter).split(delimiter||/\s+/)}},{"./isBlank":27,"./trim":65}],72:[function(require,module,exports){var makeString=require("./helper/makeString");module.exports=function wrap(str,options){str=makeString(str);options=options||{};var width=options.width||75;var seperator=options.seperator||"\n";var cut=options.cut||false;var preserveSpaces=options.preserveSpaces||false;var trailingSpaces=options.trailingSpaces||false;var result;if(width<=0){return str}else if(!cut){var words=str.split(" ");var current_column=0;result="";while(words.length>0){if(1+words[0].length+current_column>width){if(current_column>0){if(preserveSpaces){result+=" ";current_column++}else if(trailingSpaces){while(current_column<width){result+=" ";current_column++}}result+=seperator;current_column=0}}if(current_column>0){result+=" ";current_column++}result+=words[0];current_column+=words[0].length;words.shift()}if(trailingSpaces){while(current_column<width){result+=" ";current_column++}}return result}else{var index=0;result="";while(index<str.length){if(index%width==0&&index>0){result+=seperator}result+=str.charAt(index);index++}if(trailingSpaces){while(index%width>0){result+=" ";index++}}return result}}},{"./helper/makeString":20}]},{},[25]); |
var makeString = require('./helper/makeString'); | ||
var escapeChars = require('./helper/escapeChars'); | ||
var regexString = "["; | ||
var regexString = '['; | ||
for(var key in escapeChars) { | ||
regexString += key; | ||
} | ||
regexString += "]"; | ||
regexString += ']'; | ||
@@ -10,0 +10,0 @@ var regex = new RegExp( regexString, 'g'); |
@@ -5,3 +5,3 @@ module.exports = function() { | ||
for (var prop in this) { | ||
if (!this.hasOwnProperty(prop) || prop.match(/^(?:include|contains|reverse|join|map)$/)) continue; | ||
if (!this.hasOwnProperty(prop) || prop.match(/^(?:include|contains|reverse|join|map|wrap)$/)) continue; | ||
result[prop] = this[prop]; | ||
@@ -8,0 +8,0 @@ } |
@@ -6,15 +6,15 @@ /* We're explicitly defining the list of entities we want to escape. | ||
var escapeChars = { | ||
'¢' : 'cent', | ||
'£' : 'pound', | ||
'¥' : 'yen', | ||
'€': 'euro', | ||
'©' :'copy', | ||
'®' : 'reg', | ||
'<' : 'lt', | ||
'>' : 'gt', | ||
'"' : 'quot', | ||
'&' : 'amp', | ||
"'" : '#39' | ||
'¢' : 'cent', | ||
'£' : 'pound', | ||
'¥' : 'yen', | ||
'€': 'euro', | ||
'©' :'copy', | ||
'®' : 'reg', | ||
'<' : 'lt', | ||
'>' : 'gt', | ||
'"' : 'quot', | ||
'&' : 'amp', | ||
'\'' : '#39' | ||
}; | ||
module.exports = escapeChars; |
@@ -16,5 +16,5 @@ /* | ||
amp: '&', | ||
apos: "'" | ||
apos: '\'' | ||
}; | ||
module.exports = htmlEntities; |
37
index.js
@@ -1,7 +0,10 @@ | ||
// Underscore.string | ||
// (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org> | ||
// Underscore.string is freely distributable under the terms of the MIT license. | ||
// Documentation: https://github.com/epeli/underscore.string | ||
// Some code is borrowed from MooTools and Alexandru Marasteanu. | ||
// Version '3.2.3' | ||
/* | ||
* Underscore.string | ||
* (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org> | ||
* Underscore.string is freely distributable under the terms of the MIT license. | ||
* Documentation: https://github.com/epeli/underscore.string | ||
* Some code is borrowed from MooTools and Alexandru Marasteanu. | ||
* Version '3.3.0' | ||
* @preserve | ||
*/ | ||
@@ -16,3 +19,3 @@ 'use strict'; | ||
s.VERSION = '3.2.3'; | ||
s.VERSION = '3.3.0'; | ||
@@ -104,3 +107,3 @@ s.isBlank = require('./isBlank'); | ||
function fn2method(key, fn) { | ||
if (typeof fn !== "function") return; | ||
if (typeof fn !== 'function') return; | ||
s.prototype[key] = function() { | ||
@@ -117,3 +120,3 @@ var args = [this._wrapped].concat(Array.prototype.slice.call(arguments)); | ||
fn2method("tap", function tap(string, fn) { | ||
fn2method('tap', function tap(string, fn) { | ||
return fn(string); | ||
@@ -130,10 +133,10 @@ }); | ||
var prototypeMethods = [ | ||
"toUpperCase", | ||
"toLowerCase", | ||
"split", | ||
"replace", | ||
"slice", | ||
"substring", | ||
"substr", | ||
"concat" | ||
'toUpperCase', | ||
'toLowerCase', | ||
'split', | ||
'replace', | ||
'slice', | ||
'substring', | ||
'substr', | ||
'concat' | ||
]; | ||
@@ -140,0 +143,0 @@ |
@@ -6,3 +6,3 @@ // package metadata file for Meteor.js | ||
summary: 'underscore.string (official): String manipulation extensions for Underscore.js javascript library.', | ||
version: '3.2.3', | ||
version: '3.3.0', | ||
git: 'https://github.com/epeli/underscore.string.git', | ||
@@ -9,0 +9,0 @@ documentation: 'README.markdown' |
{ | ||
"name": "underscore.string", | ||
"version": "3.2.3", | ||
"version": "3.3.0", | ||
"description": "String manipulation extensions for Underscore.js javascript library.", | ||
@@ -14,3 +14,4 @@ "homepage": "http://epeli.github.com/underscore.string/", | ||
"Paul Chavard <paul@chavard.net> (<http://tchak.net>)", | ||
"Ed Finkler <coj@funkatron.com> (<http://funkatron.com>)" | ||
"Ed Finkler <coj@funkatron.com> (<http://funkatron.com>)", | ||
"Christoph Hermann <schtoeffel@gmail.com> (<https://github.com/stoeffel>)" | ||
], | ||
@@ -37,19 +38,23 @@ "keywords": [ | ||
"scripts": { | ||
"test": "gulp test" | ||
"test": "npm run test:lint && npm run test:unit && npm run coverage", | ||
"test:unit": "mocha --ui=qunit tests", | ||
"test:lint": "eslint -c .eslintrc .", | ||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha -- --report=lcov --ui=qunit tests", | ||
"build": "npm run build:clean && npm run build:bundle && npm run build:min", | ||
"build:clean": "rm -rf dist", | ||
"build:bundle": "mkdir dist && browserify index.js -o dist/underscore.string.js -p browserify-header", | ||
"build:min": "uglifyjs dist/underscore.string.js -o dist/underscore.string.min.js --comments", | ||
"release": "npm test && npm run release:version && npm run build && npm run release:push && npm publish", | ||
"release:version": "node scripts/bump-version.js", | ||
"release:push": "node scripts/push-tags.js" | ||
}, | ||
"devDependencies": { | ||
"gulp": "^3.8.11", | ||
"gulp-bench": "^1.1.0", | ||
"gulp-browserify": "~0.5.0", | ||
"gulp-bump": "~0.1.11", | ||
"gulp-eslint": "^1.1.1", | ||
"gulp-header": "^1.2.2", | ||
"gulp-istanbul": "^0.6.0", | ||
"gulp-mocha": "^2.0.0", | ||
"gulp-param": "~0.6.3", | ||
"gulp-rename": "~1.2.0", | ||
"gulp-replace": "~0.5.0", | ||
"gulp-rimraf": "^0.1.1", | ||
"gulp-uglify": "~1.0.1", | ||
"browserify": "^13.0.0", | ||
"browserify-header": "^0.9.2", | ||
"eslint": "^1.10.3", | ||
"istanbul": "^0.4.2", | ||
"mocha": "^2.1.0", | ||
"mocha-lcov-reporter": "^1.0.0", | ||
"replace": "^0.3.0", | ||
"uglifyjs": "^2.4.10", | ||
"underscore": "^1.7.0" | ||
@@ -65,3 +70,6 @@ }, | ||
}, | ||
"dependencies": {} | ||
"dependencies": { | ||
"sprintf-js": "^1.0.3", | ||
"util-deprecate": "^1.0.2" | ||
} | ||
} |
18
pad.js
@@ -16,12 +16,12 @@ var makeString = require('./helper/makeString'); | ||
switch (type) { | ||
case 'right': | ||
padlen = length - str.length; | ||
return str + strRepeat(padStr, padlen); | ||
case 'both': | ||
padlen = length - str.length; | ||
return strRepeat(padStr, Math.ceil(padlen / 2)) + str + strRepeat(padStr, Math.floor(padlen / 2)); | ||
default: // 'left' | ||
padlen = length - str.length; | ||
return strRepeat(padStr, padlen) + str; | ||
case 'right': | ||
padlen = length - str.length; | ||
return str + strRepeat(padStr, padlen); | ||
case 'both': | ||
padlen = length - str.length; | ||
return strRepeat(padStr, Math.ceil(padlen / 2)) + str + strRepeat(padStr, Math.floor(padlen / 2)); | ||
default: // 'left' | ||
padlen = length - str.length; | ||
return strRepeat(padStr, padlen) + str; | ||
} | ||
}; |
@@ -17,4 +17,4 @@ /** | ||
var tmpl = function(c) { | ||
return c.toUpperCase() !== c.toLowerCase() ? 'A' : ' '; | ||
}, | ||
return c.toUpperCase() !== c.toLowerCase() ? 'A' : ' '; | ||
}, | ||
template = str.slice(0, length + 1).replace(/.(?=\W*\w*$)/g, tmpl); // 'Hello, world' -> 'HellAA AAAAA' | ||
@@ -21,0 +21,0 @@ |
var trim = require('./trim'); | ||
var dasherize = require('./dasherize'); | ||
var cleanDiacritics = require("./cleanDiacritics"); | ||
var cleanDiacritics = require('./cleanDiacritics'); | ||
@@ -5,0 +5,0 @@ module.exports = function slugify(str) { |
126
sprintf.js
@@ -1,124 +0,4 @@ | ||
// sprintf() for JavaScript 0.7-beta1 | ||
// http://www.diveintojavascript.com/projects/javascript-sprintf | ||
// | ||
// Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com> | ||
// All rights reserved. | ||
var strRepeat = require('./helper/strRepeat'); | ||
var toString = Object.prototype.toString; | ||
var sprintf = (function() { | ||
function get_type(variable) { | ||
return toString.call(variable).slice(8, -1).toLowerCase(); | ||
} | ||
var deprecate = require('util-deprecate'); | ||
var str_repeat = strRepeat; | ||
var str_format = function() { | ||
if (!str_format.cache.hasOwnProperty(arguments[0])) { | ||
str_format.cache[arguments[0]] = str_format.parse(arguments[0]); | ||
} | ||
return str_format.format.call(null, str_format.cache[arguments[0]], arguments); | ||
}; | ||
str_format.format = function(parse_tree, argv) { | ||
var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length; | ||
for (i = 0; i < tree_length; i++) { | ||
node_type = get_type(parse_tree[i]); | ||
if (node_type === 'string') { | ||
output.push(parse_tree[i]); | ||
} | ||
else if (node_type === 'array') { | ||
match = parse_tree[i]; // convenience purposes only | ||
if (match[2]) { // keyword argument | ||
arg = argv[cursor]; | ||
for (k = 0; k < match[2].length; k++) { | ||
if (!arg.hasOwnProperty(match[2][k])) { | ||
throw new Error(sprintf('[_.sprintf] property "%s" does not exist', match[2][k])); | ||
} | ||
arg = arg[match[2][k]]; | ||
} | ||
} else if (match[1]) { // positional argument (explicit) | ||
arg = argv[match[1]]; | ||
} | ||
else { // positional argument (implicit) | ||
arg = argv[cursor++]; | ||
} | ||
if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) { | ||
throw new Error(sprintf('[_.sprintf] expecting number but found %s', get_type(arg))); | ||
} | ||
switch (match[8]) { | ||
case 'b': arg = arg.toString(2); break; | ||
case 'c': arg = String.fromCharCode(arg); break; | ||
case 'd': arg = parseInt(arg, 10); break; | ||
case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break; | ||
case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break; | ||
case 'o': arg = arg.toString(8); break; | ||
case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break; | ||
case 'u': arg = Math.abs(arg); break; | ||
case 'x': arg = arg.toString(16); break; | ||
case 'X': arg = arg.toString(16).toUpperCase(); break; | ||
} | ||
arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg); | ||
pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' '; | ||
pad_length = match[6] - String(arg).length; | ||
pad = match[6] ? str_repeat(pad_character, pad_length) : ''; | ||
output.push(match[5] ? arg + pad : pad + arg); | ||
} | ||
} | ||
return output.join(''); | ||
}; | ||
str_format.cache = {}; | ||
str_format.parse = function(fmt) { | ||
var _fmt = fmt, match = [], parse_tree = [], arg_names = 0; | ||
while (_fmt) { | ||
if ((match = /^[^\x25]+/.exec(_fmt)) !== null) { | ||
parse_tree.push(match[0]); | ||
} | ||
else if ((match = /^\x25{2}/.exec(_fmt)) !== null) { | ||
parse_tree.push('%'); | ||
} | ||
else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) { | ||
if (match[2]) { | ||
arg_names |= 1; | ||
var field_list = [], replacement_field = match[2], field_match = []; | ||
if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) { | ||
field_list.push(field_match[1]); | ||
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { | ||
if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) { | ||
field_list.push(field_match[1]); | ||
} | ||
else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) { | ||
field_list.push(field_match[1]); | ||
} | ||
else { | ||
throw new Error('[_.sprintf] huh?'); | ||
} | ||
} | ||
} | ||
else { | ||
throw new Error('[_.sprintf] huh?'); | ||
} | ||
match[2] = field_list; | ||
} | ||
else { | ||
arg_names |= 2; | ||
} | ||
if (arg_names === 3) { | ||
throw new Error('[_.sprintf] mixing positional and named placeholders is not (yet) supported'); | ||
} | ||
parse_tree.push(match); | ||
} | ||
else { | ||
throw new Error('[_.sprintf] huh?'); | ||
} | ||
_fmt = _fmt.substring(match[0].length); | ||
} | ||
return parse_tree; | ||
}; | ||
return str_format; | ||
})(); | ||
module.exports = sprintf; | ||
module.exports = deprecate(require('sprintf-js').sprintf, | ||
'sprintf() will be removed in the next major release, use the sprintf-js package instead.'); |
@@ -15,7 +15,7 @@ var trim = require('./trim'); | ||
module.exports = function toBoolean(str, trueValues, falseValues) { | ||
if (typeof str === "number") str = "" + str; | ||
if (typeof str !== "string") return !!str; | ||
if (typeof str === 'number') str = '' + str; | ||
if (typeof str !== 'string') return !!str; | ||
str = trim(str); | ||
if (boolMatch(str, trueValues || ["true", "1"])) return true; | ||
if (boolMatch(str, falseValues || ["false", "0"])) return false; | ||
if (boolMatch(str, trueValues || ['true', '1'])) return true; | ||
if (boolMatch(str, falseValues || ['false', '0'])) return false; | ||
}; |
@@ -1,6 +0,4 @@ | ||
var sprintf = require('./sprintf'); | ||
var deprecate = require('util-deprecate'); | ||
module.exports = function vsprintf(fmt, argv) { | ||
argv.unshift(fmt); | ||
return sprintf.apply(null, argv); | ||
}; | ||
module.exports = deprecate(require('sprintf-js').vsprintf, | ||
'vsprintf() will be removed in the next major release, use the sprintf-js package instead.'); |
188
wrap.js
@@ -7,97 +7,97 @@ // Wrap | ||
module.exports = function wrap(str, options){ | ||
str = makeString(str); | ||
options = options || {}; | ||
var width = options.width || 75; | ||
var seperator = options.seperator || '\n'; | ||
var cut = options.cut || false; | ||
var preserveSpaces = options.preserveSpaces || false; | ||
var trailingSpaces = options.trailingSpaces || false; | ||
str = makeString(str); | ||
options = options || {}; | ||
var width = options.width || 75; | ||
var seperator = options.seperator || '\n'; | ||
var cut = options.cut || false; | ||
var preserveSpaces = options.preserveSpaces || false; | ||
var trailingSpaces = options.trailingSpaces || false; | ||
var result; | ||
if(width <= 0){ | ||
return str; | ||
} | ||
else if(!cut){ | ||
var words = str.split(" "); | ||
var current_column = 0; | ||
result = ""; | ||
while(words.length > 0){ | ||
// if adding a space and the next word would cause this line to be longer than width... | ||
if(1 + words[0].length + current_column > width){ | ||
//start a new line if this line is not already empty | ||
if(current_column > 0){ | ||
// add a space at the end of the line is preserveSpaces is true | ||
if (preserveSpaces){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
else if(trailingSpaces){ | ||
while(current_column < width){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
} | ||
//start new line | ||
result += seperator; | ||
current_column = 0; | ||
} | ||
} | ||
// if not at the begining of the line, add a space in front of the word | ||
if(current_column > 0){ | ||
result += " "; | ||
current_column++; | ||
} | ||
// tack on the next word, update current column, a pop words array | ||
result += words[0]; | ||
current_column += words[0].length; | ||
words.shift(); | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
if(trailingSpaces){ | ||
while(current_column < width){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
} | ||
return result; | ||
} | ||
else { | ||
var index = 0; | ||
result = ""; | ||
// walk through each character and add seperators where appropriate | ||
while(index < str.length){ | ||
if(index % width == 0 && index > 0){ | ||
result += seperator; | ||
} | ||
result += str.charAt(index); | ||
index++; | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
if(trailingSpaces){ | ||
while(index % width > 0){ | ||
result += ' '; | ||
index++; | ||
} | ||
} | ||
return result; | ||
} | ||
if(width <= 0){ | ||
return str; | ||
} | ||
else if(!cut){ | ||
var words = str.split(' '); | ||
var current_column = 0; | ||
result = ''; | ||
while(words.length > 0){ | ||
// if adding a space and the next word would cause this line to be longer than width... | ||
if(1 + words[0].length + current_column > width){ | ||
//start a new line if this line is not already empty | ||
if(current_column > 0){ | ||
// add a space at the end of the line is preserveSpaces is true | ||
if (preserveSpaces){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
else if(trailingSpaces){ | ||
while(current_column < width){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
} | ||
//start new line | ||
result += seperator; | ||
current_column = 0; | ||
} | ||
} | ||
// if not at the begining of the line, add a space in front of the word | ||
if(current_column > 0){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
// tack on the next word, update current column, a pop words array | ||
result += words[0]; | ||
current_column += words[0].length; | ||
words.shift(); | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
if(trailingSpaces){ | ||
while(current_column < width){ | ||
result += ' '; | ||
current_column++; | ||
} | ||
} | ||
return result; | ||
} | ||
else { | ||
var index = 0; | ||
result = ''; | ||
// walk through each character and add seperators where appropriate | ||
while(index < str.length){ | ||
if(index % width == 0 && index > 0){ | ||
result += seperator; | ||
} | ||
result += str.charAt(index); | ||
index++; | ||
} | ||
// fill the rest of the line with spaces if trailingSpaces option is true | ||
if(trailingSpaces){ | ||
while(index % width > 0){ | ||
result += ' '; | ||
index++; | ||
} | ||
} | ||
return result; | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137210
9
2
2029
889
+ Addedsprintf-js@^1.0.3
+ Addedutil-deprecate@^1.0.2
+ Addedsprintf-js@1.1.3(transitive)
+ Addedutil-deprecate@1.0.2(transitive)