strings.js
Advanced tools
Comparing version 1.1.9 to 1.2.0
{ | ||
"name": "strings.js", | ||
"version": "1.1.9", | ||
"version": "1.2.0", | ||
"description": "A flexible, robust and powerful Javascript string manipulation library.", | ||
@@ -18,3 +18,3 @@ "main": "strings.min.js", | ||
"tool", | ||
"tools" | ||
"utility" | ||
], | ||
@@ -21,0 +21,0 @@ "author": "Dennis Raymondo <phazelift@gmail.com> (https://github.com/phazelift/)", |
233
README.md
@@ -34,2 +34,4 @@ strings.js | ||
// max 1 consecutive space! | ||
// there is much more! see below.. | ||
``` | ||
@@ -130,3 +132,6 @@ | ||
> Calls .set internally, so .set rules apply. | ||
> Calls .set internally, so .set rules apply, see below. | ||
```javascript | ||
var string= new Strings( 'All those characters..' ); | ||
``` | ||
@@ -136,3 +141,9 @@ **Strings.prototype.string** | ||
> Internal/contextual string, do not set direct, use someString.set() instead. | ||
> Internal/contextual string, do not set directly, use .set() instead to prevent bugs. You can of course use | ||
> .string as a getter to fetch the string. | ||
```javascript | ||
var myString= new Strings('The actual string'); | ||
console.log( myString.string ); | ||
// The actual string | ||
``` | ||
@@ -142,5 +153,9 @@ **Strings.prototype.set** | ||
> Sets this.string to string arguments, or resets this.string to '' if no argument is given. Arguments that or not of | ||
> Sets this.string to string arguments, or resets this.string to '' if no argument is given. Arguments that are not of | ||
> type String or Number will not be set. | ||
```javascript | ||
var string= new Strings(); | ||
string.set('James ', 'Bond ', 'is ', 0, 0, 7); | ||
// James Bond is 007 | ||
``` | ||
**Strings.prototype.sort** | ||
@@ -150,2 +165,7 @@ > `<this> sort()` | ||
> Returns this.string's characters sorted by it's ordinal value. | ||
```javascript | ||
var string= new Strings( 'sort', 'charcters', 'and', 5, 2, 9, 1 ); | ||
console.log( string.sort().$ ); | ||
// 1259aaccdehnorrrsstt | ||
``` | ||
@@ -157,2 +177,7 @@ **Strings.prototype.random** | ||
> If you want a custom range, you can better use: new Strings('mysecret007shuffle').shuffle() | ||
```javascript | ||
// 10 random special characters | ||
console.log( new Strings().random(10, Strings.ASCII_RANGE_SPECIAL_1) ); | ||
// &!! %.,./* | ||
``` | ||
@@ -166,2 +191,12 @@ **Strings.prototype.xs** | ||
> Any character, String or Number returned by callback will be applied to index in string. | ||
```javascript | ||
var string= new Strings('It is easy to change characters in any way!'); | ||
string.xs( function(ch){ | ||
return (ch === ' ') | ||
? ' * ' | ||
: true; | ||
}); | ||
console.log( string.$ ); | ||
// It * is * easy * to * change * characters * in * any * way! | ||
``` | ||
@@ -172,2 +207,6 @@ **Strings.prototype.times** | ||
> Duplicates this.string by amount, or leaves this.string unchanged if no amount is given. | ||
```javascript | ||
console.log( new Strings('<3 ').times(3).$ ); | ||
// <3 <3 <3 | ||
``` | ||
@@ -179,2 +218,7 @@ **Strings.prototype.get** | ||
> Without arguments get() returns the full this.string. | ||
```javascript | ||
var string= new Strings('sdblaem'); | ||
console.log( string.get(5, 1, 1, -2, -1, 3, 4, -2, 2) ); | ||
// assembled | ||
``` | ||
@@ -192,2 +236,7 @@ **Strings.prototype.$** | ||
> If no arguments are given, a full copy of this.string is returned. | ||
```javascript | ||
var string= new Strings('copy a part'); | ||
console.log( string.copy(-4, 4) ); | ||
// part | ||
``` | ||
@@ -198,2 +247,6 @@ **Strings.prototype.empty** | ||
> Returns true if this.string.length is < 1. | ||
```javascript | ||
console.log( new Strings().empty() ); | ||
// true | ||
``` | ||
@@ -204,2 +257,6 @@ **Strings.isAlpha** | ||
> Returns true if this.string is in the range ['a'..'z'] and/or ['A'..'Z'] | ||
```javascript | ||
console.log( new Strings('abcIsAlpha').isAlpha() ); | ||
// true | ||
``` | ||
@@ -210,2 +267,6 @@ **Strings.isNumeric** | ||
> Returns true if this.string is in the range ['0'..'9'] | ||
```javascript | ||
console.log( new Strings('123').isNumeric() ); | ||
// true | ||
``` | ||
@@ -216,2 +277,6 @@ **Strings.isAlphaNumeric** | ||
> Returns true if this.string is in the range ['a'..'z'] and/or ['A'..'Z'] and/or ['0'..'9'] | ||
```javascript | ||
console.log( new Strings('abc123').isAlphaNumeric() ); | ||
// true | ||
``` | ||
@@ -221,3 +286,9 @@ **Strings.isSpecial** | ||
> Returns true if this.string is *NOT* in the range ['a'..'z'] and/or ['A'..'Z'] and/or ['0'..'9'] | ||
> Returns true if this.string is *NOT* in the range ['a'..'z'] and/or ['A'..'Z'] and/or ['0'..'9'], but *in* the | ||
> range of all printable ascii characters. | ||
```javascript | ||
console.log( new Strings('!@ #$').isSpecial() ); | ||
// true | ||
// note that space is a special character! | ||
``` | ||
@@ -228,2 +299,6 @@ **Strings.prototype.isSpace** | ||
> Returns true if this.string contains no characters other than spaces and/or horizontal tabs. | ||
```javascript | ||
console.log( new Strings(' \t ').isSpace() ); | ||
// true | ||
``` | ||
@@ -234,2 +309,7 @@ **Strings.prototype.push** | ||
> Append string(s) to this.string. | ||
```javascript | ||
var string= new Strings('add to this ').push('string', '?'); | ||
console.log( string.$ ); | ||
// add to this string? | ||
``` | ||
@@ -241,2 +321,7 @@ **Strings.prototype.pop** | ||
> character. | ||
```javascript | ||
var string= new Strings('remove characters from the end').pop(13); | ||
console.log( string.$ ); | ||
// remove characters | ||
``` | ||
@@ -247,2 +332,6 @@ **Strings.prototype.prepend** | ||
> Prepend this.string with string(s). | ||
```javascript | ||
var string= new Strings('to prepend').prepend(1, '. some', ' strings '); | ||
console.log( string.$ ); | ||
// 1. some strings to prepend | ||
@@ -258,2 +347,6 @@ **Strings.prototype.insert** | ||
> so, if our string is `'123'` and we insert `'-'` at position 2 and 3, we will get `'1-2-3'`. | ||
```javascript | ||
var string= new Strings('wherearethespaces?').insert(' ', 6, 9, 12 ); | ||
console.log( string.$ ); | ||
// where are the spaces? | ||
@@ -265,2 +358,7 @@ **Strings.prototype.trim** | ||
> beginning and the end of the string. | ||
```javascript | ||
var string= new Strings(' \t remove leading and trailing tabs and spaces \t').trim(); | ||
console.log( string.$ ); | ||
// remove leading and trailing tabs and spaces | ||
``` | ||
@@ -282,3 +380,7 @@ **Strings.prototype.trimLeft** | ||
> Reduces all horizontal tabs and/or spaces found in this.string to a maximum of one. | ||
> Reduces all consecutive horizontal tabs and/or spaces found in this.string to a maximum of one. | ||
```javascript | ||
var string= new Strings('sparse strings \t cleaned up!').oneSpace(); | ||
console.log( string.$ ); | ||
// sparse strings cleaned up! | ||
@@ -289,2 +391,6 @@ **Strings.prototype.oneSpaceAndTrim** | ||
> Applies this.trim() and this.oneSpace() on this.string. | ||
```javascript | ||
var string= new Strings(' \t sparse strings \t cleaned up! \t ').oneSpaceAndTrim(); | ||
console.log( string.$ ); | ||
// sparse strings cleaned up! | ||
@@ -297,2 +403,6 @@ **Strings.prototype.find** | ||
> find internally uses RegExp, so flags is 100% compatible with RegExp flags. | ||
```javascript | ||
console.log( new Strings('find character positions').find(' ') ); | ||
// [ 5, 15 ] | ||
``` | ||
@@ -303,2 +413,8 @@ **Strings.prototype.count** | ||
> Returns the amount of times substring is found in this.string. | ||
```javascript | ||
console.log( new Strings('now count the spaces in this string').count(' ') ); | ||
// 6 | ||
console.log( new Strings('count substrings in this string').count('string') ); | ||
// 2 | ||
``` | ||
@@ -309,2 +425,6 @@ **Strings.prototype.contains** | ||
> Returns true if string is a substring of this.string, false if not. | ||
```javascript | ||
console.log( new Strings('any spaces in here?').contains('spaces') ); | ||
// true | ||
``` | ||
@@ -316,2 +436,6 @@ **Strings.prototype.between** | ||
> after are matched. An empty string is returned in case of no match. | ||
```javascript | ||
console.log( new Strings('what is (between) the braces?').between('(', ')') ); | ||
// between | ||
``` | ||
@@ -322,2 +446,6 @@ **Strings.prototype.slice** | ||
> Crop this.string from offset with amount. | ||
```javascript | ||
console.log( new Strings('fetch a slice of this').slice(9, 5).$ ); | ||
// slice | ||
``` | ||
@@ -331,2 +459,8 @@ **Strings.prototype.crop** | ||
> Removes all characters after offset from this.string, and optionally add a suffix. | ||
```javascript | ||
var string= new Strings('is truncate pop with a suffix?') | ||
.truncate(15, '? No, it counts from the start, and you can add a suffix.'); | ||
console.log( string.$ ); | ||
// is truncate pop? No, it counts from the start and you can add a suffix. | ||
``` | ||
@@ -337,2 +471,7 @@ **Strings.prototype.remove** | ||
> - Arguments are substrings - Remove all found/matching strings given as arguments from this.string. | ||
```javascript | ||
var string= new Strings('what is the lifetime of a string?'); | ||
console.log( string.remove( 'what', 'is ', '?').$ ); | ||
// the lifetime of a string | ||
``` | ||
@@ -343,2 +482,7 @@ **Strings.prototype.removeRange** | ||
> Removes amount character(s) from this.string, starting from index. | ||
```javascript | ||
var string= new Strings('what is the lifetime of a string?'); | ||
console.log( string.removeRange(8, 16).$ ); | ||
// what is a string? | ||
``` | ||
@@ -349,2 +493,7 @@ **Strings.prototype.removePos** | ||
> - Arguments are indices - Remove all (one character) positions given as arguments, from this.string. | ||
```javascript | ||
var string= new Strings('remove single characters from this string?'); | ||
console.log( string.removePos(-1, 1, 2) ); | ||
// move single characters from this string | ||
``` | ||
@@ -356,2 +505,6 @@ **Strings.prototype.replace** | ||
> As Strings.replace internally uses RegExp you can set flags to your liking. flags defaults to 'g' (global) | ||
```javascript | ||
console.log( new Strings('almost standard..').replace('almost', 'not so').$ ); | ||
// not so standard | ||
``` | ||
@@ -362,2 +515,6 @@ **Strings.prototype.reverse** | ||
> Reverses this.string. | ||
```javascript | ||
console.log( new Strings('desrever').reverse().$ ); | ||
// reversed | ||
``` | ||
@@ -370,2 +527,8 @@ **Strings.prototype.upper** | ||
> Multiple character strings are matched as well. | ||
```javascript | ||
console.log( new Strings('change case').upper('c').$ ); | ||
// Change Case | ||
console.log( new Strings('change case').upper(1, 3, 5, -2, -4).$ ); | ||
// ChAnGe CaSe | ||
``` | ||
@@ -375,5 +538,3 @@ **Strings.prototype.lower** | ||
> If arg(s) are number(s), the character(s) in this.string at index or indexes are changed to lowercase. | ||
> If arg(s) are character, all matching characters in this.string are changed to lowercase. | ||
> Multiple character strings are matched as well. | ||
> Same as .upper, it only changes uppercase characters to lowercase. | ||
@@ -383,3 +544,7 @@ **Strings.prototype.shuffle** | ||
> Randomizes the position of each character in this.string. | ||
> Randomizes(pseudo) the position of each character in this.string. | ||
```javascript | ||
console.log( new Strings('shuffle').shuffle().$ ); | ||
// fsfluhe (pseudo random) | ||
``` | ||
@@ -390,2 +555,6 @@ **Strings.prototype.toCamel** | ||
> Converts every following character matching char in this.string to uppercase, and removes char. | ||
```javascript | ||
console.log( new Strings('underscores_to_camels').toCamel('_').$ ); | ||
underscoresToCamels | ||
``` | ||
@@ -397,2 +566,6 @@ **Strings.prototype.unCamel** | ||
> to any character of your liking. | ||
```javascript | ||
console.log( new Strings('underscoresFromCamels').unCamel('_').$ ); | ||
underscores_from_camels | ||
``` | ||
@@ -403,2 +576,6 @@ **Strings.prototype.startsWith** | ||
> Returns true if this.string starts with start, false if not. | ||
```javascript | ||
console.log( new Strings('abc 123').startsWith('ab') ); | ||
// true | ||
``` | ||
@@ -409,2 +586,6 @@ **Strings.prototype.endsWith** | ||
> Returns true if this.string ends with ending, false if not. | ||
```javascript | ||
console.log( new Strings('abc 123').endsWith('23') ); | ||
// true | ||
``` | ||
@@ -418,2 +599,14 @@ **Strings.prototype.setWrap** | ||
> You can add to prepend and append (outwards) by calling .setWrap again. | ||
```javascript | ||
var string= new Strings('<3').setWrap( 'she ', ' me'); | ||
console.log( string.$ ); | ||
// <3 | ||
console.log( string.wrap ); | ||
// she <3 me | ||
string.setWrap('would ', ' forever?'); | ||
console.log( string.wrap ); | ||
// would she <3 me forever? | ||
console.log( string.$+ '..' ); | ||
// <3.. | ||
``` | ||
@@ -430,2 +623,7 @@ **Strings.prototype.removeWrap** | ||
> to this.string. Finally the wrapper method will be reset with removeWrap. | ||
```javascript | ||
var string= new Strings('<3').applyWrap( 'She ', '\'s me!'); | ||
console.log( string.$ ); | ||
// She <3's me! | ||
``` | ||
@@ -707,2 +905,17 @@ **Strings.prototype.wrap** | ||
**1.2.0** | ||
Started improving the running-speed of all methods. It's a work in progress. | ||
Removed due to optimization: | ||
- Chars.isUpper, Chars.isLower, Chars.isAlpha, Chars.isNumeric, Chars.isSpecial, Chars.isAlphaNumeric | ||
Optimized (some stage..): | ||
- Strings.isUpper, Strings.isLower, Strings.isAlpha, Strings.isNumeric, Strings.isSpecial, | ||
Strings.isAlphaNumeric, Strings.startsWith | ||
Added elementary running-speed results, to be found in tests. | ||
Updated Jasmine tests and readme. | ||
__________________________________ | ||
**1.1.9** | ||
@@ -709,0 +922,0 @@ |
@@ -307,2 +307,10 @@ // Generated by CoffeeScript 1.8.0 | ||
Chars.ASCII_RANGE_SPECIAL_1 = [32, 47]; | ||
Chars.ASCII_RANGE_SPECIAL_2 = [58, 64]; | ||
Chars.ASCII_RANGE_SPECIAL_3 = [91, 96]; | ||
Chars.ASCII_RANGE_SPECIAL_4 = [123, 126]; | ||
Chars.ASCII_RANGE_ALL = [32, 126]; | ||
@@ -320,26 +328,2 @@ | ||
Chars.isUpper = function(char) { | ||
return _.inRange(Chars.ordinal(char), Chars.ASCII_RANGE_UPPERCASE); | ||
}; | ||
Chars.isLower = function(char) { | ||
return _.inRange(Chars.ordinal(char), Chars.ASCII_RANGE_LOWERCASE); | ||
}; | ||
Chars.isAlpha = function(char) { | ||
return Chars.isUpper(char) || Chars.isLower(char); | ||
}; | ||
Chars.isNumeric = function(char) { | ||
return _.inRange(Chars.ordinal(char), Chars.ASCII_RANGE_NUMBERS); | ||
}; | ||
Chars.isSpecial = function(char) { | ||
return _.inRange(Chars.ordinal(char), Chars.ASCII_RANGE_ALL) && !(Chars.isAlphaNumeric(char) || (char === ' ')); | ||
}; | ||
Chars.isAlphaNumeric = function(char) { | ||
return Chars.isAlpha(char) || Chars.isNumeric(char); | ||
}; | ||
Chars.random = function(range) { | ||
@@ -482,15 +466,27 @@ var max, min; | ||
Strings.isAlpha = function(string) { | ||
return asciiStringType(string, Chars.isAlpha); | ||
if ('' === (string = _.forceString(string))) { | ||
return false; | ||
} | ||
return /^[a-z]*$/ig.test(string); | ||
}; | ||
Strings.isNumeric = function(string) { | ||
return asciiStringType(string, Chars.isNumeric); | ||
if ('' === (string = _.forceString(string))) { | ||
return false; | ||
} | ||
return /^[0-9]*$/g.test(string); | ||
}; | ||
Strings.isAlphaNumeric = function(string) { | ||
return asciiStringType(string, Chars.isAlphaNumeric); | ||
if ('' === (string = _.forceString(string))) { | ||
return false; | ||
} | ||
return /^[0-9|a-z]*$/ig.test(string); | ||
}; | ||
Strings.isSpecial = function(string) { | ||
return asciiStringType(string, Chars.isSpecial); | ||
if ('' === (string = _.forceString(string))) { | ||
return false; | ||
} | ||
return /^[^0-9|a-z]*$/ig.test(string); | ||
}; | ||
@@ -787,3 +783,7 @@ | ||
Strings.startsWith = function(string, start) { | ||
return Strings.find(string, start)[0] === 1; | ||
if (('' === (string = _.forceString(string))) || ('' === (start = _.forceString(start)))) { | ||
return false; | ||
} | ||
start = new RegExp('^' + Strings.regEscape(start)); | ||
return start.test(string); | ||
}; | ||
@@ -1095,2 +1095,4 @@ | ||
console.log(new Strings('!@ #$').isSpecial()); | ||
if (typeof window !== "undefined" && window !== null) { | ||
@@ -1097,0 +1099,0 @@ window.Strings = Strings; |
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";var t,r,n,e,i,o,u,s,c,f,a,p,g,l={}.hasOwnProperty,h=function(t,r){function n(){this.constructor=t}for(var e in r)l.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},m=[].slice,y=[].indexOf||function(t){for(var r=0,n=this.length;n>r;r++)if(r in this&&this[r]===t)return r;return-1};s=function(){var t;return t=new Number,t["void"]=!0,t},n={parseIntBase:10},c={Boolean:!1,String:"",Number:s(),Object:{},Array:[],Function:function(){}},u=function(t){var r;return r=function(r){switch(t){case"Number":if(n.isNumber(r=parseInt(r,n.parseIntBase)))return r;break;case"String":if(n.isStringOrNumber(r))return r+"";break;default:if(n["is"+t](r))return r}return!1},function(n,e){return!1!==(n=r(n))?n:!1!==(e=r(e))?e:c[t]}},a=function(t,r,n){var e,i,o;if(null==n&&(n=[]),n.length<1)return t===p.Undefined?!0:!1;for(i=0,o=n.length;o>i;i++)if(e=n[i],t(e)===r)return r;return!r},p={Undefined:function(t){return void 0===t},Null:function(t){return null===t},Boolean:function(t){return"boolean"==typeof t},String:function(t){return"string"==typeof t},Function:function(t){return"function"==typeof t},Number:function(t){return"number"==typeof t&&t===t||"object"==typeof t&&t instanceof Number&&t["void"]},Array:function(t){return"object"==typeof t&&t instanceof Array},RegExp:function(t){return"object"==typeof t&&t instanceof RegExp},Date:function(t){return"object"==typeof t&&t instanceof Date},Object:function(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof RegExp||t instanceof Date)},NaN:function(t){return"number"==typeof t&&t!==t},Defined:function(t){return void 0!==t}},p.StringOrNumber=function(t){return p.String(t)||p.Number(t)},i=!0,function(){var t,r,e;e=[];for(t in p)r=p[t],e.push(function(t,r){return n["is"+t]=r,n["not"+t]=function(t){return!r(t)},n["has"+t]=function(){return a(r,i,arguments)},n["all"+t]=function(){return a(r,!i,arguments)},t in c?n["force"+t]=u(t):void 0}(t,r));return e}(),n["typeof"]=function(t){var r,n;for(n in p)if(r=p[n],r(t)===!0)return n.toLowerCase();return"unknown"},f=function(t){var r,n,e,i,o;if(g.notArray(t))return 0;for(r=i=0,o=t.length;o>i;r=++i){if(e=t[r],n=g.forceNumber(e),n["void"])return r;t[r]=n}return t.length},g=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return h(r,t),r.inRange=function(t,n){return r.isNaN(t=parseInt(t,10))||f(n)<2?!1:t>=n[0]&&t<=n[1]},r.limitNumber=function(t,n){return t=r.forceNumber(t,0),f(n)<2?t:t<n[0]?n[0]:t>n[1]?n[1]:t},r.randomNumber=function(t,r){return f([t,r])<2?0:t>r?t:(r=r-t+1,Math.floor(Math.random()*r+t))},r.shuffleArray=function(t){var n,e,i,o,u;if(r.notArray(t)||t.length<1)return[];for(e=t.length-1,n=u=e;0>=e?0>=u:u>=0;n=0>=e?++u:--u)i=r.randomNumber(0,n),o=t[n],t[n]=t[i],t[i]=o;return t},r.positiveIndex=function(t,n){return 0===(t=r.forceNumber(t,0))?!1:(n=Math.abs(r.forceNumber(n)),Math.abs(t)<=n?t>0?t-1:n+t:!1)},r.insertSort=function(t){var r,n,e,i,o;for(e=t.length-1,n=o=1;e>=1?e>=o:o>=e;n=e>=1?++o:--o){for(r=t[n],i=n-1;i>=0&&t[i]>r;)t[i+1]=t[i],--i;t[+i+1]=r}return t},r.noDupAndReverse=function(t){var r,n,e,i;for(n=t.length-1,e=[],r=i=n;0>=n?0>=i:i>=0;r=0>=n?++i:--i)e[e.length-1]!==t[r]&&e.push(t[r]);return e},r.sortNoDupAndReverse=function(t,n){var e,i,o,u,s;for(i=[],e=u=0,s=t.length;s>u;e=++u)o=t[e],o=r.forceNumber(o),o["void"]||(n>=o&&(o=r.positiveIndex(o,n)),i.push(r.forceNumber(o,0)));return r.noDupAndReverse(r.insertSort(i))},r}(n),t=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return h(r,t),r.ASCII_RANGE_UPPERCASE=[65,90],r.ASCII_RANGE_LOWERCASE=[97,122],r.ASCII_RANGE_NUMBERS=[48,57],r.ASCII_RANGE_ALL=[32,126],r.REGEXP_SPECIAL_CHARS=["?","\\","[","]","(",")","*","+",".","/","|","^","$","<",">","-","&"],r.ascii=function(t){return String.fromCharCode(g.forceNumber(t))},r.ordinal=function(t){return g.forceNumber(g.forceString(t).charCodeAt(),0)},r.isUpper=function(t){return g.inRange(r.ordinal(t),r.ASCII_RANGE_UPPERCASE)},r.isLower=function(t){return g.inRange(r.ordinal(t),r.ASCII_RANGE_LOWERCASE)},r.isAlpha=function(t){return r.isUpper(t)||r.isLower(t)},r.isNumeric=function(t){return g.inRange(r.ordinal(t),r.ASCII_RANGE_NUMBERS)},r.isSpecial=function(t){return g.inRange(r.ordinal(t),r.ASCII_RANGE_ALL)&&!(r.isAlphaNumeric(t)||" "===t)},r.isAlphaNumeric=function(t){return r.isAlpha(t)||r.isNumeric(t)},r.random=function(t){var n,e;return t=g.forceArray(t,r.ASCII_RANGE_ALL),e=g.limitNumber(t[0],t),n=g.limitNumber(t[1],t),r.ascii(g.randomNumber(e,n))},r}(g),o=function(){var t,n,e,i,o,u,s,c,f;if(o=arguments[0],e=arguments[1],n=3<=arguments.length?m.call(arguments,2):[],null==o&&(o=""),""===(o=g.forceString(o)))return o;if(n.length<1||void 0===n[0])return o[e]();if(g.isNumber(n[0]))for(u=0,c=n.length;c>u;u++)t=n[u],i=g.positiveIndex(t,o.length),o=r.xs(o,function(t,r){return r===i?t[e]():t});else if(g.isString(n[0]))for(s=0,f=n.length;f>s;s++)t=n[s],o=r.replace(o,t,t[e](),"gi");return o},e=function(t,r){var n,e,i;if(""===(t=g.forceString(t)))return!1;for(e=0,i=t.length;i>e;e++)if(n=t[e],!r(n))return!1;return!0},r=function(r){function n(){this.set.apply(this,arguments),this.wrapMethod=null,this.crop=this.slice}return h(n,r),n.create=function(){var t,r,n,e;for(r="",n=0,e=arguments.length;e>n;n++)t=arguments[n],r+=g.forceString(t);return r},n.get=function(){var t,r,n,e,i,o,u;if(o=arguments[0],e=2<=arguments.length?m.call(arguments,1):[],arguments.length<2)return"";for(o=g.forceString(o),r=o.length,i="",t=arguments.length,n=u=1;t>=1?t>=u:u>=t;n=t>=1?++u:--u)n=g.positiveIndex(arguments[n],r),n!==!1&&(i+=o[n]);return i},n.sort=function(t){return t=g.forceString(t).trim().split(""),g.insertSort(t).join("")},n.random=function(r,n){var e,i,o;for(r=g.forceNumber(r,1),i="",e=o=1;r>=1?r>=o:o>=r;e=r>=1?++o:--o)i+=t.random(n);return i},n.times=function(t,r){var n;if(""===(t=g.forceString(t)))return"";for(r=g.forceNumber(r,1),n="";r-->0;)n+=t;return n},n.regEscape=function(r){return""===(r=g.forceString(r))?r:n.xs(r,function(r){return y.call(t.REGEXP_SPECIAL_CHARS,r)>=0?"\\"+r:!0})},n.empty=function(t){return g.notString(t)||t.length>0?!1:!0},n.isAlpha=function(r){return e(r,t.isAlpha)},n.isNumeric=function(r){return e(r,t.isNumeric)},n.isAlphaNumeric=function(r){return e(r,t.isAlphaNumeric)},n.isSpecial=function(r){return e(r,t.isSpecial)},n.isSpace=function(t){return/^[ \t]+$/g.test(t)},n.xs=function(t,r){var n,e,i,o,u;if(null==t&&(t=""),t=g.forceString(t),-1===(e=t.length-1))return"";for(r=g.forceFunction(r,function(t){return t}),o="",n=u=0;e>=0?e>=u:u>=e;n=e>=0?++u:--u)(i=r(t[n],n))&&(i===!0?o+=t[n]:g.isStringOrNumber(i)&&(o+=i));return o},n.copy=function(t,r,n){return r=g.forceNumber(r),""===(t=g.forceString(t))||Math.abs(r)>t.length?"":(r>0&&(r-=1),t.substr(r,g.forceNumber(n,t.length)))},n.replace=function(t,r,e,i){var o;return null==t&&(t=""),null==r&&(r=""),null==e&&(e=""),null==i&&(i="g"),!g.isStringOrNumber(t)||"string"!==(o=g["typeof"](r))&&"number"!==o&&"regexp"!==o?g.forceString(t):(g.notRegExp(r)&&(r=n.regEscape(r+""),r=new RegExp(r,i)),(t+"").replace(r,e))},n.trim=function(t){return n.replace(t,/^\s+|\s+$/g)},n.trimLeft=function(t){return n.replace(t,/^\s+/g)},n.trimRight=function(t){return n.replace(t,/\s+$/g)},n.oneSpace=function(t){return n.replace(t,/\s+/g," ")},n.oneSpaceAndTrim=function(t){return n.oneSpace(n.trim(t))},n.toCamel=function(t,r){var e;return t=g.forceString(t),r=g.forceString(r,"-"),e=new RegExp(n.regEscape(r)+"([a-z])","ig"),n.replace(t,e,function(t,r){return r.toUpperCase()})},n.unCamel=function(t,r){return t=g.forceString(t),r=g.forceString(r,"-"),n.replace(t,/([A-Z])/g,r+"$1").toLowerCase()},n.shuffle=function(t){return t=g.forceString(t),g.shuffleArray((t+"").split("")).join("")},n.find=function(t,r,e){var i,o;if(i=[],""===(t=g.forceString(t)))return i;if(e=g.forceString(e,"g"),g.isStringOrNumber(r))r=new RegExp(n.regEscape(r+""),e);else{if(!g.isRegExp(r))return i;r=new RegExp(r.source,e)}if(r.global)for(;o=r.exec(t);)i.push(o.index+1);else(o=r.exec(t))&&i.push(o.index+1);return i},n.count=function(t,r){return n.find(t,r).length},n.contains=function(t,r){return n.count(t,r)>0},n.between=function(t,r,e){var i,o;return g.allStringOrNumber(t,r,e)?(r=n.regEscape(r+""),e=n.regEscape(e+""),i=new RegExp(r+"(.+)"+e),(null!=(o=i.exec(t+""))?o[1]:void 0)||""):""},n.slice=function(t,r,n){return t=g.forceString(t),r=g.forceNumber(r||1),!1!==(r=g.positiveIndex(r,t.length))?(n=g.forceNumber(n),t.slice(r,r+n)):""},n.truncate=function(t,r,e){return t=g.forceString(t),r=g.forceNumber(r,t.length),t=n.slice(t,1,r),t+g.forceString(e)},n.pop=function(t,r){return t=g.forceString(t),r=g.forceNumber(r,1),t.slice(0,-Math.abs(r))},n.split=function(t,r){var e,i,o,u,s;if(t=n.oneSpaceAndTrim(t),i=[],t.length<1)return i;for(r=g.forceString(r," "),e=t.split(r[0]||""),u=0,s=e.length;s>u;u++)o=e[u],o.match(/^\s$/)||i.push(n.trim(o));return i},n.reverse=function(t){var r,n,e,i;if(null==t&&(t=""),t=g.forceString(t),(n=t.length-1)<1)return t;for(e="",r=i=n;0>=n?0>=i:i>=0;r=0>=n?++i:--i)e+=t[r];return e},n.upper=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],o.apply(null,[r,"toUpperCase"].concat(m.call(t)))},n.lower=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],o.apply(null,[r,"toLowerCase"].concat(m.call(t)))},n.insert=function(){var t,r,n,e,i,o;if(i=arguments[0],r=arguments[1],e=3<=arguments.length?m.call(arguments,2):[],""===(i=g.forceString(i))||""===(r=g.forceString(r)))return i;if(e=g.sortNoDupAndReverse(e,i.length),n=f(e)-1,0>n)return i;for(t=o=0;n>=0?n>=o:o>=n;t=n>=0?++o:--o)t=e[t],t>i.length?i+=r:i=i.substr(0,t)+r+i.substr(t);return i},n.removeRange=function(t,r,e){var i;return t=g.forceString(t),""===t||!1===(r=g.positiveIndex(r,t.length))||0>(e=g.forceNumber(e,1))?t:(i=r+e,n.xs(t,function(t,n){return r>n||n>=i?!0:void 0}))},n.removePos=function(){var t,r,e;return e=arguments[0],r=2<=arguments.length?m.call(arguments,1):[],""===(e=g.forceString(e))?"":(t=r.map(function(t){return g.positiveIndex(t,e.length)}),n.xs(e,function(r,n){return y.call(t,n)>=0?void 0:!0}))},n.remove=function(){var t,r,e,i,o;if(r=arguments[0],e=2<=arguments.length?m.call(arguments,1):[],null==r&&(r=""),""===(r=g.forceString(r))||e.length<1)return r;for(i=0,o=e.length;o>i;i++)t=e[i],r=n.replace(r,t);return r},n.startsWith=function(t,r){return 1===n.find(t,r)[0]},n.endsWith=function(t,r){return""===(t=g.forceString(t))||""===(r=g.forceString(r))?!1:(r=new RegExp(n.regEscape(r)+"$"),r.test(t))},n.wrap=function(t,r){var e;return null==t&&(t=""),null==r&&(r=""),e=function(e){return n.create(t,e,r)},e.wrap=function(n,e){return null==n&&(n=""),null==e&&(e=""),t=g.forceString(n)+t,r+=g.forceString(e)},e},n.prototype.set=function(){return this.string=n.create.apply(this,arguments),this},n.prototype.sort=function(){return this.string=n.sort(this.string),this},n.prototype.random=function(t,r){return this.string=n.random(t,r),this},n.prototype.xs=function(t){return this.string=n.xs(this.string,t),this},n.prototype.times=function(t){return null==t&&(t=1),this.string=n.times(this.string,t),this},n.prototype.get=function(){var t,r,n,e;if(arguments.length>0){for(r="",n=0,e=arguments.length;e>n;n++)t=arguments[n],t=g.positiveIndex(t,this.length),t!==!1&&(r+=this.string[t]);return r}return this.string},n.prototype.copy=function(t,r){return n.copy(this.string,t,r)},n.prototype.empty=function(){return n.empty(this.string)},n.prototype.isAlpha=function(){return n.isAlpha(this.string)},n.prototype.isNumeric=function(){return n.isNumeric(this.string)},n.prototype.isAlphaNumeric=function(){return n.isAlphaNumeric(this.string)},n.prototype.isSpecial=function(){return n.isSpecial(this.string)},n.prototype.isSpace=function(){return n.isSpace(this.string)},n.prototype.push=function(){return this.string=this.string+n.create.apply(this,arguments),this},n.prototype.prepend=function(){return this.string=n.create.apply(this,arguments)+this.string,this},n.prototype.pop=function(t){return this.string=n.pop(this.string,t),this},n.prototype.insert=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],this.string=n.insert.apply(n,[this.string,r].concat(m.call(t))),this},n.prototype.trim=function(){return this.string=n.trim(this.string),this},n.prototype.trimLeft=function(){return this.string=n.trimLeft(this.string),this},n.prototype.trimRight=function(){return this.string=n.trimRight(this.string),this},n.prototype.oneSpace=function(){return this.string=n.oneSpace(this.string),this},n.prototype.oneSpaceAndTrim=function(){return this.string=n.oneSpaceAndTrim(this.string),this},n.prototype.find=function(t){return n.find(this.string,t)},n.prototype.count=function(t){return n.count(this.string,t)},n.prototype.contains=function(t){return n.contains(this.string,t)},n.prototype.between=function(t,r){return n.between(this.string,t,r)},n.prototype.slice=function(t,r){return this.string=n.slice(this.string,t,r),this},n.prototype.truncate=function(t,r){return this.string=n.truncate(this.string,t,r),this},n.prototype.remove=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.remove.apply(n,[this.string].concat(m.call(t))),this},n.prototype.removeRange=function(t,r){return this.string=n.removeRange(this.string,t,r),this},n.prototype.removePos=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.removePos.apply(n,[this.string].concat(m.call(t))),this},n.prototype.replace=function(t,r,e){return this.string=n.replace(this.string,t,r,e),this},n.prototype.reverse=function(){return this.string=n.reverse(this.string),this},n.prototype.upper=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.upper.apply(n,[this.string].concat(m.call(t))),this},n.prototype.lower=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.lower.apply(n,[this.string].concat(m.call(t))),this},n.prototype.shuffle=function(){return this.string=n.shuffle(this.string),this},n.prototype.toCamel=function(t){return this.string=n.toCamel(this.string,t),this},n.prototype.unCamel=function(t){return this.string=n.unCamel(this.string,t),this},n.prototype.startsWith=function(t){return n.startsWith(this.string,t)},n.prototype.endsWith=function(t){return n.endsWith(this.string,t)},n.prototype.setWrap=function(t,r){return g.isNull(this.wrapMethod)?this.wrapMethod=n.wrap(t,r):this.wrapMethod.wrap(t,r),this},n.prototype.removeWrap=function(){return this.wrapMethod=null,this},n.prototype.applyWrap=function(t,r){return this.string=this.setWrap(t,r).wrap,this.removeWrap(),this},n}(t),Object.defineProperty(r.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(r.prototype,"length",{get:function(){return this.string.length}}),Object.defineProperty(r.prototype,"wrap",{get:function(){return g.isNull(this.wrapMethod)?this.string:this.wrapMethod(this.string)}}),r.Types=n,r.Chars=t,r.crop=r.slice,r.prototype.crop=r.prototype.slice,r.prototype.append=r.prototype.push,"undefined"!=typeof window&&null!==window?window.Strings=r:module.exports=r}).call(this); | ||
(function(){"use strict";var t,r,n,e,i,o,u,s,c,f,a,p,g,l={}.hasOwnProperty,h=function(t,r){function n(){this.constructor=t}for(var e in r)l.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},m=[].slice,y=[].indexOf||function(t){for(var r=0,n=this.length;n>r;r++)if(r in this&&this[r]===t)return r;return-1};s=function(){var t;return t=new Number,t["void"]=!0,t},n={parseIntBase:10},c={Boolean:!1,String:"",Number:s(),Object:{},Array:[],Function:function(){}},u=function(t){var r;return r=function(r){switch(t){case"Number":if(n.isNumber(r=parseInt(r,n.parseIntBase)))return r;break;case"String":if(n.isStringOrNumber(r))return r+"";break;default:if(n["is"+t](r))return r}return!1},function(n,e){return!1!==(n=r(n))?n:!1!==(e=r(e))?e:c[t]}},a=function(t,r,n){var e,i,o;if(null==n&&(n=[]),n.length<1)return t===p.Undefined?!0:!1;for(i=0,o=n.length;o>i;i++)if(e=n[i],t(e)===r)return r;return!r},p={Undefined:function(t){return void 0===t},Null:function(t){return null===t},Boolean:function(t){return"boolean"==typeof t},String:function(t){return"string"==typeof t},Function:function(t){return"function"==typeof t},Number:function(t){return"number"==typeof t&&t===t||"object"==typeof t&&t instanceof Number&&t["void"]},Array:function(t){return"object"==typeof t&&t instanceof Array},RegExp:function(t){return"object"==typeof t&&t instanceof RegExp},Date:function(t){return"object"==typeof t&&t instanceof Date},Object:function(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof RegExp||t instanceof Date)},NaN:function(t){return"number"==typeof t&&t!==t},Defined:function(t){return void 0!==t}},p.StringOrNumber=function(t){return p.String(t)||p.Number(t)},i=!0,function(){var t,r,e;e=[];for(t in p)r=p[t],e.push(function(t,r){return n["is"+t]=r,n["not"+t]=function(t){return!r(t)},n["has"+t]=function(){return a(r,i,arguments)},n["all"+t]=function(){return a(r,!i,arguments)},t in c?n["force"+t]=u(t):void 0}(t,r));return e}(),n["typeof"]=function(t){var r,n;for(n in p)if(r=p[n],r(t)===!0)return n.toLowerCase();return"unknown"},f=function(t){var r,n,e,i,o;if(g.notArray(t))return 0;for(r=i=0,o=t.length;o>i;r=++i){if(e=t[r],n=g.forceNumber(e),n["void"])return r;t[r]=n}return t.length},g=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return h(r,t),r.inRange=function(t,n){return r.isNaN(t=parseInt(t,10))||f(n)<2?!1:t>=n[0]&&t<=n[1]},r.limitNumber=function(t,n){return t=r.forceNumber(t,0),f(n)<2?t:t<n[0]?n[0]:t>n[1]?n[1]:t},r.randomNumber=function(t,r){return f([t,r])<2?0:t>r?t:(r=r-t+1,Math.floor(Math.random()*r+t))},r.shuffleArray=function(t){var n,e,i,o,u;if(r.notArray(t)||t.length<1)return[];for(e=t.length-1,n=u=e;0>=e?0>=u:u>=0;n=0>=e?++u:--u)i=r.randomNumber(0,n),o=t[n],t[n]=t[i],t[i]=o;return t},r.positiveIndex=function(t,n){return 0===(t=r.forceNumber(t,0))?!1:(n=Math.abs(r.forceNumber(n)),Math.abs(t)<=n?t>0?t-1:n+t:!1)},r.insertSort=function(t){var r,n,e,i,o;for(e=t.length-1,n=o=1;e>=1?e>=o:o>=e;n=e>=1?++o:--o){for(r=t[n],i=n-1;i>=0&&t[i]>r;)t[i+1]=t[i],--i;t[+i+1]=r}return t},r.noDupAndReverse=function(t){var r,n,e,i;for(n=t.length-1,e=[],r=i=n;0>=n?0>=i:i>=0;r=0>=n?++i:--i)e[e.length-1]!==t[r]&&e.push(t[r]);return e},r.sortNoDupAndReverse=function(t,n){var e,i,o,u,s;for(i=[],e=u=0,s=t.length;s>u;e=++u)o=t[e],o=r.forceNumber(o),o["void"]||(n>=o&&(o=r.positiveIndex(o,n)),i.push(r.forceNumber(o,0)));return r.noDupAndReverse(r.insertSort(i))},r}(n),t=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return h(r,t),r.ASCII_RANGE_UPPERCASE=[65,90],r.ASCII_RANGE_LOWERCASE=[97,122],r.ASCII_RANGE_NUMBERS=[48,57],r.ASCII_RANGE_SPECIAL_1=[32,47],r.ASCII_RANGE_SPECIAL_2=[58,64],r.ASCII_RANGE_SPECIAL_3=[91,96],r.ASCII_RANGE_SPECIAL_4=[123,126],r.ASCII_RANGE_ALL=[32,126],r.REGEXP_SPECIAL_CHARS=["?","\\","[","]","(",")","*","+",".","/","|","^","$","<",">","-","&"],r.ascii=function(t){return String.fromCharCode(g.forceNumber(t))},r.ordinal=function(t){return g.forceNumber(g.forceString(t).charCodeAt(),0)},r.random=function(t){var n,e;return t=g.forceArray(t,r.ASCII_RANGE_ALL),e=g.limitNumber(t[0],t),n=g.limitNumber(t[1],t),r.ascii(g.randomNumber(e,n))},r}(g),o=function(){var t,n,e,i,o,u,s,c,f;if(o=arguments[0],e=arguments[1],n=3<=arguments.length?m.call(arguments,2):[],null==o&&(o=""),""===(o=g.forceString(o)))return o;if(n.length<1||void 0===n[0])return o[e]();if(g.isNumber(n[0]))for(u=0,c=n.length;c>u;u++)t=n[u],i=g.positiveIndex(t,o.length),o=r.xs(o,function(t,r){return r===i?t[e]():t});else if(g.isString(n[0]))for(s=0,f=n.length;f>s;s++)t=n[s],o=r.replace(o,t,t[e](),"gi");return o},e=function(t,r){var n,e,i;if(""===(t=g.forceString(t)))return!1;for(e=0,i=t.length;i>e;e++)if(n=t[e],!r(n))return!1;return!0},r=function(r){function n(){this.set.apply(this,arguments),this.wrapMethod=null,this.crop=this.slice}return h(n,r),n.create=function(){var t,r,n,e;for(r="",n=0,e=arguments.length;e>n;n++)t=arguments[n],r+=g.forceString(t);return r},n.get=function(){var t,r,n,e,i,o,u;if(o=arguments[0],e=2<=arguments.length?m.call(arguments,1):[],arguments.length<2)return"";for(o=g.forceString(o),r=o.length,i="",t=arguments.length,n=u=1;t>=1?t>=u:u>=t;n=t>=1?++u:--u)n=g.positiveIndex(arguments[n],r),n!==!1&&(i+=o[n]);return i},n.sort=function(t){return t=g.forceString(t).trim().split(""),g.insertSort(t).join("")},n.random=function(r,n){var e,i,o;for(r=g.forceNumber(r,1),i="",e=o=1;r>=1?r>=o:o>=r;e=r>=1?++o:--o)i+=t.random(n);return i},n.times=function(t,r){var n;if(""===(t=g.forceString(t)))return"";for(r=g.forceNumber(r,1),n="";r-->0;)n+=t;return n},n.regEscape=function(r){return""===(r=g.forceString(r))?r:n.xs(r,function(r){return y.call(t.REGEXP_SPECIAL_CHARS,r)>=0?"\\"+r:!0})},n.empty=function(t){return g.notString(t)||t.length>0?!1:!0},n.isAlpha=function(t){return""===(t=g.forceString(t))?!1:/^[a-z]*$/gi.test(t)},n.isNumeric=function(t){return""===(t=g.forceString(t))?!1:/^[0-9]*$/g.test(t)},n.isAlphaNumeric=function(t){return""===(t=g.forceString(t))?!1:/^[0-9|a-z]*$/gi.test(t)},n.isSpecial=function(t){return""===(t=g.forceString(t))?!1:/^[^0-9|a-z]*$/gi.test(t)},n.isSpace=function(t){return/^[ \t]+$/g.test(t)},n.xs=function(t,r){var n,e,i,o,u;if(null==t&&(t=""),t=g.forceString(t),-1===(e=t.length-1))return"";for(r=g.forceFunction(r,function(t){return t}),o="",n=u=0;e>=0?e>=u:u>=e;n=e>=0?++u:--u)(i=r(t[n],n))&&(i===!0?o+=t[n]:g.isStringOrNumber(i)&&(o+=i));return o},n.copy=function(t,r,n){return r=g.forceNumber(r),""===(t=g.forceString(t))||Math.abs(r)>t.length?"":(r>0&&(r-=1),t.substr(r,g.forceNumber(n,t.length)))},n.replace=function(t,r,e,i){var o;return null==t&&(t=""),null==r&&(r=""),null==e&&(e=""),null==i&&(i="g"),!g.isStringOrNumber(t)||"string"!==(o=g["typeof"](r))&&"number"!==o&&"regexp"!==o?g.forceString(t):(g.notRegExp(r)&&(r=n.regEscape(r+""),r=new RegExp(r,i)),(t+"").replace(r,e))},n.trim=function(t){return n.replace(t,/^\s+|\s+$/g)},n.trimLeft=function(t){return n.replace(t,/^\s+/g)},n.trimRight=function(t){return n.replace(t,/\s+$/g)},n.oneSpace=function(t){return n.replace(t,/\s+/g," ")},n.oneSpaceAndTrim=function(t){return n.oneSpace(n.trim(t))},n.toCamel=function(t,r){var e;return t=g.forceString(t),r=g.forceString(r,"-"),e=new RegExp(n.regEscape(r)+"([a-z])","ig"),n.replace(t,e,function(t,r){return r.toUpperCase()})},n.unCamel=function(t,r){return t=g.forceString(t),r=g.forceString(r,"-"),n.replace(t,/([A-Z])/g,r+"$1").toLowerCase()},n.shuffle=function(t){return t=g.forceString(t),g.shuffleArray((t+"").split("")).join("")},n.find=function(t,r,e){var i,o;if(i=[],""===(t=g.forceString(t)))return i;if(e=g.forceString(e,"g"),g.isStringOrNumber(r))r=new RegExp(n.regEscape(r+""),e);else{if(!g.isRegExp(r))return i;r=new RegExp(r.source,e)}if(r.global)for(;o=r.exec(t);)i.push(o.index+1);else(o=r.exec(t))&&i.push(o.index+1);return i},n.count=function(t,r){return n.find(t,r).length},n.contains=function(t,r){return n.count(t,r)>0},n.between=function(t,r,e){var i,o;return g.allStringOrNumber(t,r,e)?(r=n.regEscape(r+""),e=n.regEscape(e+""),i=new RegExp(r+"(.+)"+e),(null!=(o=i.exec(t+""))?o[1]:void 0)||""):""},n.slice=function(t,r,n){return t=g.forceString(t),r=g.forceNumber(r||1),!1!==(r=g.positiveIndex(r,t.length))?(n=g.forceNumber(n),t.slice(r,r+n)):""},n.truncate=function(t,r,e){return t=g.forceString(t),r=g.forceNumber(r,t.length),t=n.slice(t,1,r),t+g.forceString(e)},n.pop=function(t,r){return t=g.forceString(t),r=g.forceNumber(r,1),t.slice(0,-Math.abs(r))},n.split=function(t,r){var e,i,o,u,s;if(t=n.oneSpaceAndTrim(t),i=[],t.length<1)return i;for(r=g.forceString(r," "),e=t.split(r[0]||""),u=0,s=e.length;s>u;u++)o=e[u],o.match(/^\s$/)||i.push(n.trim(o));return i},n.reverse=function(t){var r,n,e,i;if(null==t&&(t=""),t=g.forceString(t),(n=t.length-1)<1)return t;for(e="",r=i=n;0>=n?0>=i:i>=0;r=0>=n?++i:--i)e+=t[r];return e},n.upper=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],o.apply(null,[r,"toUpperCase"].concat(m.call(t)))},n.lower=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],o.apply(null,[r,"toLowerCase"].concat(m.call(t)))},n.insert=function(){var t,r,n,e,i,o;if(i=arguments[0],r=arguments[1],e=3<=arguments.length?m.call(arguments,2):[],""===(i=g.forceString(i))||""===(r=g.forceString(r)))return i;if(e=g.sortNoDupAndReverse(e,i.length),n=f(e)-1,0>n)return i;for(t=o=0;n>=0?n>=o:o>=n;t=n>=0?++o:--o)t=e[t],t>i.length?i+=r:i=i.substr(0,t)+r+i.substr(t);return i},n.removeRange=function(t,r,e){var i;return t=g.forceString(t),""===t||!1===(r=g.positiveIndex(r,t.length))||0>(e=g.forceNumber(e,1))?t:(i=r+e,n.xs(t,function(t,n){return r>n||n>=i?!0:void 0}))},n.removePos=function(){var t,r,e;return e=arguments[0],r=2<=arguments.length?m.call(arguments,1):[],""===(e=g.forceString(e))?"":(t=r.map(function(t){return g.positiveIndex(t,e.length)}),n.xs(e,function(r,n){return y.call(t,n)>=0?void 0:!0}))},n.remove=function(){var t,r,e,i,o;if(r=arguments[0],e=2<=arguments.length?m.call(arguments,1):[],null==r&&(r=""),""===(r=g.forceString(r))||e.length<1)return r;for(i=0,o=e.length;o>i;i++)t=e[i],r=n.replace(r,t);return r},n.startsWith=function(t,r){return""===(t=g.forceString(t))||""===(r=g.forceString(r))?!1:(r=new RegExp("^"+n.regEscape(r)),r.test(t))},n.endsWith=function(t,r){return""===(t=g.forceString(t))||""===(r=g.forceString(r))?!1:(r=new RegExp(n.regEscape(r)+"$"),r.test(t))},n.wrap=function(t,r){var e;return null==t&&(t=""),null==r&&(r=""),e=function(e){return n.create(t,e,r)},e.wrap=function(n,e){return null==n&&(n=""),null==e&&(e=""),t=g.forceString(n)+t,r+=g.forceString(e)},e},n.prototype.set=function(){return this.string=n.create.apply(this,arguments),this},n.prototype.sort=function(){return this.string=n.sort(this.string),this},n.prototype.random=function(t,r){return this.string=n.random(t,r),this},n.prototype.xs=function(t){return this.string=n.xs(this.string,t),this},n.prototype.times=function(t){return null==t&&(t=1),this.string=n.times(this.string,t),this},n.prototype.get=function(){var t,r,n,e;if(arguments.length>0){for(r="",n=0,e=arguments.length;e>n;n++)t=arguments[n],t=g.positiveIndex(t,this.length),t!==!1&&(r+=this.string[t]);return r}return this.string},n.prototype.copy=function(t,r){return n.copy(this.string,t,r)},n.prototype.empty=function(){return n.empty(this.string)},n.prototype.isAlpha=function(){return n.isAlpha(this.string)},n.prototype.isNumeric=function(){return n.isNumeric(this.string)},n.prototype.isAlphaNumeric=function(){return n.isAlphaNumeric(this.string)},n.prototype.isSpecial=function(){return n.isSpecial(this.string)},n.prototype.isSpace=function(){return n.isSpace(this.string)},n.prototype.push=function(){return this.string=this.string+n.create.apply(this,arguments),this},n.prototype.prepend=function(){return this.string=n.create.apply(this,arguments)+this.string,this},n.prototype.pop=function(t){return this.string=n.pop(this.string,t),this},n.prototype.insert=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],this.string=n.insert.apply(n,[this.string,r].concat(m.call(t))),this},n.prototype.trim=function(){return this.string=n.trim(this.string),this},n.prototype.trimLeft=function(){return this.string=n.trimLeft(this.string),this},n.prototype.trimRight=function(){return this.string=n.trimRight(this.string),this},n.prototype.oneSpace=function(){return this.string=n.oneSpace(this.string),this},n.prototype.oneSpaceAndTrim=function(){return this.string=n.oneSpaceAndTrim(this.string),this},n.prototype.find=function(t){return n.find(this.string,t)},n.prototype.count=function(t){return n.count(this.string,t)},n.prototype.contains=function(t){return n.contains(this.string,t)},n.prototype.between=function(t,r){return n.between(this.string,t,r)},n.prototype.slice=function(t,r){return this.string=n.slice(this.string,t,r),this},n.prototype.truncate=function(t,r){return this.string=n.truncate(this.string,t,r),this},n.prototype.remove=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.remove.apply(n,[this.string].concat(m.call(t))),this},n.prototype.removeRange=function(t,r){return this.string=n.removeRange(this.string,t,r),this},n.prototype.removePos=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.removePos.apply(n,[this.string].concat(m.call(t))),this},n.prototype.replace=function(t,r,e){return this.string=n.replace(this.string,t,r,e),this},n.prototype.reverse=function(){return this.string=n.reverse(this.string),this},n.prototype.upper=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.upper.apply(n,[this.string].concat(m.call(t))),this},n.prototype.lower=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.lower.apply(n,[this.string].concat(m.call(t))),this},n.prototype.shuffle=function(){return this.string=n.shuffle(this.string),this},n.prototype.toCamel=function(t){return this.string=n.toCamel(this.string,t),this},n.prototype.unCamel=function(t){return this.string=n.unCamel(this.string,t),this},n.prototype.startsWith=function(t){return n.startsWith(this.string,t)},n.prototype.endsWith=function(t){return n.endsWith(this.string,t)},n.prototype.setWrap=function(t,r){return g.isNull(this.wrapMethod)?this.wrapMethod=n.wrap(t,r):this.wrapMethod.wrap(t,r),this},n.prototype.removeWrap=function(){return this.wrapMethod=null,this},n.prototype.applyWrap=function(t,r){return this.string=this.setWrap(t,r).wrap,this.removeWrap(),this},n}(t),Object.defineProperty(r.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(r.prototype,"length",{get:function(){return this.string.length}}),Object.defineProperty(r.prototype,"wrap",{get:function(){return g.isNull(this.wrapMethod)?this.string:this.wrapMethod(this.string)}}),r.Types=n,r.Chars=t,r.crop=r.slice,r.prototype.crop=r.prototype.slice,r.prototype.append=r.prototype.push,console.log(new r("!@ #$").isSpecial()),"undefined"!=typeof window&&null!==window?window.Strings=r:module.exports=r}).call(this); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
210096
10
918
2493