Comparing version 0.3.51 to 0.3.71
{ | ||
"name": "words.js", | ||
"version": "0.3.51", | ||
"version": "0.3.71", | ||
"description": "A flexible, robust and powerful Javascript word-string manipulation library.", | ||
@@ -5,0 +5,0 @@ "main": "words.min.js", |
@@ -87,5 +87,36 @@ words.js | ||
Everywhere you see `<string>/<number>`, it means you can either enter a String or Number argument, both will be parsed | ||
If you see `<string>/<number>`, it means you can either enter a String or Number argument, both will be parsed | ||
correctly. | ||
**Words.flexArgs** | ||
> `Words.flexArgs( arg1, ..., argN )` | ||
If you see the type `<flexArgs>` in the API, it refers to a convenience method I use for flexible arguments passing. | ||
A stack variable accepting flexArgs accepts 3 types of arguments: | ||
type |example | ||
------------------------|--------------------------- | ||
space delimited strings |'this is my string' | ||
multiple arguments |'this', 'is', 'my', 'string' | ||
array |['this', 'is', 'my', 'string'] | ||
Each generating the same result. | ||
flexArgs can be used as follows: | ||
```javascript | ||
function testArgs( arg1, arg2, argN ){ | ||
// need to .apply with context for all arguments to pass | ||
var array= Words.flexArgs.apply( this, arguments ); | ||
console.log( array ); | ||
} | ||
testArgs( 'a', 'b', 'c' ); | ||
// [ 'a', 'b', 'c' ] | ||
testArgs( ['a', 'b', 'c'] ); | ||
// [ 'a', 'b', 'c' ] | ||
testArgs( 'a b c' ); | ||
// [ 'a', 'b', 'c' ] | ||
``` | ||
___ | ||
**Words.prototype.words** | ||
@@ -122,6 +153,6 @@ > `<array> words` | ||
**Words.prototype.set** | ||
> `<this> set( <string>/<number> index, [index1, ..., indexN] )` | ||
> `<this> set( <flexArgs> string1, ..., stringN )` | ||
> Set this.words. Use any combination of arguments to form a string. All | ||
> invalid arguments will be ignored. | ||
> Set this.words with string(s). The strings can be given in the 3 flexArgs forms, see .flexArgs description on top of the API. | ||
> Use any combination of arguments to form a string. All invalid arguments will be ignored. | ||
@@ -283,10 +314,14 @@ ```javascript | ||
**Words.prototype.pop** | ||
> `<this> pop( <string>/<number> amount )` | ||
> `<string> pop( <string>/<number> amount )` | ||
> Removes the last word from this.words if no arguments are given. If amount is valid, amount words will | ||
> be removed from this.words, starting from the last word going backwards. | ||
> Removes the last word from this.words if no arguments are given. If amount is valid, amount words will be removed from | ||
> this.words, starting from the last word going backwards. | ||
> A string of all words 'popped' in reverse order, will be returned. | ||
```javascript | ||
var words= new Words( 'pop means: remove words from the end of this string' ); | ||
console.log( words.pop(3).$ ); | ||
var words= new Words( 'pop means: get and remove words from the end of this string' ); | ||
console.log( words.pop(3) ); | ||
// of this string | ||
console.log( words.$ ); | ||
// pop means: remove words from the end | ||
@@ -390,3 +425,16 @@ ``` | ||
========== | ||
**0.3.7** | ||
Changed: | ||
- Words.prototype.pop: .pop used to return context to allow for chaining, but I decided to have it return a reverse ordered | ||
(space delimited) string of the popped words instead. I missed that feature and considered it more valuable. Unfortunately | ||
this can break some code, so check your project before upgrading it to this version. | ||
Added Words.flexArgs convenience method in order to allow more flexible input. The constructor and Words.prototype.set are now | ||
accepting: space delimited strings, multiple arguments and array | ||
___ | ||
**0.3.6** | ||
Updated the included strings.js to version 1.2.3 | ||
___ | ||
**0.3.2** | ||
@@ -393,0 +441,0 @@ |
@@ -14,5 +14,2 @@ | ||
result= new Words( [1, 2, 3] ).$; | ||
expect( result ).toBe( '' ); | ||
result= new Words( true ).$; | ||
@@ -45,2 +42,16 @@ expect( result ).toBe( '' ); | ||
}); | ||
it("should accept space delimited string, multiple arguments and array", function(){ | ||
result= new Words('this should be split into words').$; | ||
expect( result ).toBe( 'this should be split into words' ); | ||
result= new Words(['this', 'should', 'be', 'split', 'into', 'words']).$; | ||
expect( result ).toBe( 'this should be split into words' ); | ||
result= new Words('this', 'should', 'be', 'split', 'into', 'words').$; | ||
expect( result ).toBe( 'this should be split into words' ); | ||
}); | ||
}); | ||
@@ -491,12 +502,12 @@ | ||
it("should always return the context", function(){ | ||
it("should always return a string", function(){ | ||
result= words.pop() | ||
expect( result ).toBe( words ); | ||
result= typeof words.pop() | ||
expect( result ).toBe( 'string' ); | ||
result= words.pop( null ) | ||
expect( result ).toBe( words ); | ||
result= typeof words.pop( null ) | ||
expect( result ).toBe( 'string' ); | ||
result= words.pop( [] ) | ||
expect( result ).toBe( words ); | ||
result= typeof words.pop( [] ) | ||
expect( result ).toBe( 'string' ); | ||
}); | ||
@@ -507,11 +518,14 @@ | ||
words.set('pop some words from this string'); | ||
result= words.pop().$ | ||
words.pop(); | ||
result= words.$; | ||
expect( result ).toBe( 'pop some words from this' ); | ||
words.set('pop some words from this string'); | ||
result= words.pop( null ).$ | ||
words.pop( null ); | ||
result= words.$; | ||
expect( result ).toBe( 'pop some words from this' ); | ||
words.set('pop some words from this string'); | ||
result= words.pop( true ).$ | ||
words.pop( true ); | ||
result= words.$; | ||
expect( result ).toBe( 'pop some words from this' ); | ||
@@ -523,22 +537,50 @@ }); | ||
words.set('pop some words from this string'); | ||
result= words.pop( 1 ).$ | ||
words.pop( 1 ); | ||
result= words.$ | ||
expect( result ).toBe( 'pop some words from this' ); | ||
words.set('pop some words from this string'); | ||
result= words.pop( 3 ).$ | ||
words.pop( 3 ); | ||
result= words.$ | ||
expect( result ).toBe( 'pop some words' ); | ||
words.set('pop some words from this string'); | ||
result= words.pop( -3 ).$ | ||
words.pop( -3 ); | ||
result= words.$ | ||
expect( result ).toBe( 'pop some words' ); | ||
words.set('pop some words from this string'); | ||
result= words.pop( '-3px' ).$ | ||
words.pop( '-3px' ); | ||
result= words.$ | ||
expect( result ).toBe( 'pop some words' ); | ||
words.set('pop some words from this string'); | ||
result= words.pop( [5] ).$ | ||
words.pop( [5] ); | ||
result= words.$ | ||
expect( result ).toBe( 'pop' ); | ||
}); | ||
it("should return the popped words in reversed order, as space delimited string", function(){ | ||
words.set('pop some words from this string'); | ||
result= words.pop( 1 ); | ||
expect( result ).toBe( 'string' ); | ||
words.set('pop some words from this string'); | ||
result= words.pop( 3 ); | ||
expect( result ).toBe( 'from this string' ); | ||
words.set('pop some words from this string'); | ||
result= words.pop( -3 ); | ||
expect( result ).toBe( 'from this string' ); | ||
words.set('pop some words from this string'); | ||
result= words.pop( '-3px' ); | ||
expect( result ).toBe( 'from this string' ); | ||
words.set('pop some words from this string'); | ||
result= words.pop( [5] ); | ||
expect( result ).toBe( 'some words from this string' ); | ||
}); | ||
}); | ||
@@ -545,0 +587,0 @@ |
57
words.js
@@ -189,2 +189,15 @@ // Generated by CoffeeScript 1.8.0 | ||
_.flexArgs = function() { | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
if (args.length < 2) { | ||
if (_.isString(args[0])) { | ||
args = Strings.split(args.join(' ')); | ||
} else if (_.isArray(args[0])) { | ||
args = args[0]; | ||
} | ||
} | ||
return args; | ||
}; | ||
_.inRange = function(nr, range) { | ||
@@ -493,2 +506,14 @@ if ((_.isNaN(nr = parseInt(nr, 10))) || (mapStringToNumber(range) < 2)) { | ||
Strings.hasUpper = function(string) { | ||
return /[A-Z]+/g.test(string); | ||
}; | ||
Strings.isUpper = function(string) { | ||
return /^[A-Z]+$/g.test(string); | ||
}; | ||
Strings.isLower = function(string) { | ||
return /^[a-z]+$/g.test(string); | ||
}; | ||
Strings.xs = function(string, callback) { | ||
@@ -896,2 +921,14 @@ var index, length, response, result, _i; | ||
Strings.prototype.isUpper = function() { | ||
return Strings.isUpper(this.string); | ||
}; | ||
Strings.prototype.hasUpper = function() { | ||
return Strings.hasUpper(this.string); | ||
}; | ||
Strings.prototype.isLower = function() { | ||
return Strings.isLower(this.string); | ||
}; | ||
Strings.prototype.push = function() { | ||
@@ -1180,9 +1217,11 @@ this.string = this.string + Strings.create.apply(this, arguments); | ||
Words.prototype.set = function() { | ||
var arg, str, _i, _j, _len, _len1, _ref; | ||
var arg, args, str, _i, _j, _len, _len1, _ref; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
this.words = []; | ||
if (arguments.length < 1) { | ||
args = _.flexArgs.apply(this, args); | ||
if (args.length < 1) { | ||
return this; | ||
} | ||
for (_i = 0, _len = arguments.length; _i < _len; _i++) { | ||
arg = arguments[_i]; | ||
for (_i = 0, _len = args.length; _i < _len; _i++) { | ||
arg = args[_i]; | ||
_ref = Strings.split(Strings.create(arg), Words_.delimiter); | ||
@@ -1365,8 +1404,12 @@ for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { | ||
Words.prototype.pop = function(amount) { | ||
var n, _i; | ||
var n, pop, popped, _i; | ||
amount = Math.abs(_.forceNumber(amount, 1)); | ||
popped = ''; | ||
for (n = _i = 1; 1 <= amount ? _i <= amount : _i >= amount; n = 1 <= amount ? ++_i : --_i) { | ||
this.words.pop(); | ||
pop = this.words.pop(); | ||
if (pop !== void 0) { | ||
popped = pop + ' ' + popped; | ||
} | ||
} | ||
return this; | ||
return popped.trim(); | ||
}; | ||
@@ -1373,0 +1416,0 @@ |
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";var t,r,n,e,i,o,u,s,c,f,p,a,g,h,l,m={}.hasOwnProperty,y=function(t,r){function n(){this.constructor=t}for(var e in r)m.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},d=[].slice,v=[].indexOf||function(t){for(var r=0,n=this.length;n>r;r++)if(r in this&&this[r]===t)return r;return-1};p=function(t,r){return r instanceof t},h=function(t,r){return null==r&&(r="object"),typeof t===r},r={Boolean:!1,String:"",Object:{},Array:[],Function:function(){},Number:function(){var t;return t=new Number,t["void"]=!0,t}()},i={Undefined:function(t){return void 0===t},Null:function(t){return null===t},Function:function(t){return h(t,"function")},Boolean:function(t){return h(t,"boolean")},String:function(t){return h(t,"string")},Array:function(t){return h(t)&&p(Array,t)},RegExp:function(t){return h(t)&&p(RegExp,t)},Date:function(t){return h(t)&&p(Date,t)},Number:function(t){return h(t,"number")&&t===t||h(t)&&p(Number,t)},Object:function(t){return!(!h(t)||null===t||p(Boolean,t)||p(Number,t)||p(Array,t)||p(RegExp,t)||p(Date,t))},NaN:function(t){return h(t,"number")&&t!==t},Defined:function(t){return void 0!==t}},i.StringOrNumber=function(t){return i.String(t)||i.Number(t)},o=l={parseIntBase:10},f=function(t){var n;return n=function(r){switch(t){case"Number":if(l.isNumber(r=parseInt(r,l.parseIntBase))&&!r["void"])return r;break;case"String":if(l.isStringOrNumber(r))return r+"";break;default:if(o["is"+t](r))return r}},function(e,i){return null!=e&&void 0!==(e=n(e))?e:null!=i&&void 0!==(i=n(i))?i:r[t]}},g=function(t,r,n){var e,o,u;if(null==n&&(n=[]),n.length<1)return t===i.Undefined;for(o=0,u=n.length;u>o;o++)if(e=n[o],t(e)===r)return r;return!r},c=!0,function(){var t,n,e;e=[];for(t in i)n=i[t],e.push(function(t,n){return o["is"+t]=n,o["not"+t]=function(t){return!n(t)},o["has"+t]=function(){return g(n,c,arguments)},o["all"+t]=function(){return g(n,!c,arguments)},t in r?o["force"+t]=f(t):void 0}(t,n));return e}(),o["typeof"]=function(t){var r,n;for(r in i)if(n=i[r],n(t)===!0)return r.toLowerCase()},a=function(t){var r,n,e,i,o;if(l.notArray(t))return 0;for(r=i=0,o=t.length;o>i;r=++i){if(e=t[r],n=l.forceNumber(e),n["void"])return r;t[r]=n}return t.length},l=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return y(r,t),r.inRange=function(t,n){return r.isNaN(t=parseInt(t,10))||a(n)<2?!1:t>=n[0]&&t<=n[1]},r.limitNumber=function(t,n){return t=r.forceNumber(t,0),a(n)<2?t:t<n[0]?n[0]:t>n[1]?n[1]:t},r.randomNumber=function(t,r){return a([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}(o),t=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return y(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(l.forceNumber(t))},r.ordinal=function(t){return l.forceNumber(l.forceString(t).charCodeAt(),0)},r.random=function(t){var n,e;return t=l.forceArray(t,r.ASCII_RANGE_ALL),e=l.limitNumber(t[0],t),n=l.limitNumber(t[1],t),r.ascii(l.randomNumber(e,n))},r}(l),e=function(){function t(){}return t.changeCase=function(){var t,r,e,i,o,u,s,c,f;if(o=arguments[0],e=arguments[1],r=3<=arguments.length?d.call(arguments,2):[],null==o&&(o=""),""===(o=l.forceString(o)))return o;if(r.length<1||void 0===r[0])return o[e]();if(l.isNumber(r[0]))for(u=0,c=r.length;c>u;u++)t=r[u],i=l.positiveIndex(t,o.length),o=n.xs(o,function(t,r){return r===i?t[e]():t});else if(l.isString(r[0]))for(s=0,f=r.length;f>s;s++)t=r[s],o=n.replace(o,t,t[e](),"gi");return o},t}(),n=function(r){function n(){this.set.apply(this,arguments),this.wrapMethod=null,this.crop=this.slice}return y(n,r),n.create=function(){var t,r,n,e;for(r="",n=0,e=arguments.length;e>n;n++)t=arguments[n],r+=l.forceString(t);return r},n.get=function(){var t,r,n,e,i,o,u;if(o=arguments[0],e=2<=arguments.length?d.call(arguments,1):[],arguments.length<2)return"";for(o=l.forceString(o),r=o.length,i="",t=arguments.length,n=u=1;t>=1?t>=u:u>=t;n=t>=1?++u:--u)n=l.positiveIndex(arguments[n],r),n!==!1&&(i+=o[n]);return i},n.sort=function(t){return t=l.forceString(t).trim().split(""),l.insertSort(t).join("")},n.random=function(r,n){var e,i,o;for(r=l.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=l.forceString(t)))return"";for(r=l.forceNumber(r,1),n="";r-->0;)n+=t;return n},n.regEscape=function(r){return""===(r=l.forceString(r))?r:n.xs(r,function(r){return v.call(t.REGEXP_SPECIAL_CHARS,r)>=0?"\\"+r:!0})},n.empty=function(t){return l.notString(t)||t.length>0?!1:!0},n.isAlpha=function(t){return""===(t=l.forceString(t))?!1:/^[a-z]*$/gi.test(t)},n.isNumeric=function(t){return""===(t=l.forceString(t))?!1:/^[0-9]*$/g.test(t)},n.isAlphaNumeric=function(t){return""===(t=l.forceString(t))?!1:/^[0-9|a-z]*$/gi.test(t)},n.isSpecial=function(t){return""===(t=l.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=l.forceString(t),-1===(e=t.length-1))return"";for(r=l.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]:l.isStringOrNumber(i)&&(o+=i));return o},n.copy=function(t,r,n){return r=l.forceNumber(r),""===(t=l.forceString(t))||Math.abs(r)>t.length?"":(r>0&&(r-=1),t.substr(r,l.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"),!l.isStringOrNumber(t)||"string"!==(o=l["typeof"](r))&&"number"!==o&&"regexp"!==o?l.forceString(t):(l.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=l.forceString(t),r=l.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=l.forceString(t),r=l.forceString(r,"-"),n.replace(t,/([A-Z])/g,r+"$1").toLowerCase()},n.shuffle=function(t){return t=l.forceString(t),l.shuffleArray((t+"").split("")).join("")},n.find=function(t,r,e){var i,o;if(i=[],""===(t=l.forceString(t)))return i;if(e=l.forceString(e,"g"),l.isStringOrNumber(r))r=new RegExp(n.regEscape(r+""),e);else{if(!l.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 l.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=l.forceString(t),r=l.forceNumber(r||1),!1!==(r=l.positiveIndex(r,t.length))?(n=l.forceNumber(n),t.slice(r,r+n)):""},n.truncate=function(t,r,e){return t=l.forceString(t),r=l.forceNumber(r,t.length),t=n.slice(t,1,r),t+l.forceString(e)},n.pop=function(t,r){return t=l.forceString(t),r=l.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=l.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=l.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?d.call(arguments,1):[],e.changeCase.apply(e,[r,"toUpperCase"].concat(d.call(t)))},n.lower=function(){var t,r;return r=arguments[0],t=2<=arguments.length?d.call(arguments,1):[],e.changeCase.apply(e,[r,"toLowerCase"].concat(d.call(t)))},n.insert=function(){var t,r,n,e,i,o;if(i=arguments[0],r=arguments[1],e=3<=arguments.length?d.call(arguments,2):[],""===(i=l.forceString(i))||""===(r=l.forceString(r)))return i;if(e=l.sortNoDupAndReverse(e,i.length),n=a(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=l.forceString(t),""===t||!1===(r=l.positiveIndex(r,t.length))||0>(e=l.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?d.call(arguments,1):[],""===(e=l.forceString(e))?"":(t=r.map(function(t){return l.positiveIndex(t,e.length)}),n.xs(e,function(r,n){return v.call(t,n)>=0?void 0:!0}))},n.remove=function(){var t,r,e,i,o;if(r=arguments[0],e=2<=arguments.length?d.call(arguments,1):[],null==r&&(r=""),""===(r=l.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=l.forceString(t))||""===(r=l.forceString(r))?!1:(r=new RegExp("^"+n.regEscape(r)),r.test(t))},n.endsWith=function(t,r){return""===(t=l.forceString(t))||""===(r=l.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=l.forceString(n)+t,r+=l.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=l.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?d.call(arguments,1):[],this.string=n.insert.apply(n,[this.string,r].concat(d.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?d.call(arguments,0):[],this.string=n.remove.apply(n,[this.string].concat(d.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?d.call(arguments,0):[],this.string=n.removePos.apply(n,[this.string].concat(d.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?d.call(arguments,0):[],this.string=n.upper.apply(n,[this.string].concat(d.call(t))),this},n.prototype.lower=function(){var t;return t=1<=arguments.length?d.call(arguments,0):[],this.string=n.lower.apply(n,[this.string].concat(d.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 l.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(n.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(n.prototype,"length",{get:function(){return this.string.length}}),Object.defineProperty(n.prototype,"wrap",{get:function(){return l.isNull(this.wrapMethod)?this.string:this.wrapMethod(this.string)}}),n.Types=o,n.Chars=t,n.crop=n.slice,n.prototype.crop=n.prototype.slice,n.prototype.append=n.prototype.push,s=function(){function t(){}return t.delimiter=" ",t.stringsFromArray=function(t){var r,n,e,i,o;for(r=[],o=l.forceArray(t),e=0,i=o.length;i>e;e++)n=o[e],l.isString(n)&&r.push(n);return r},t.numbersFromArray=function(t){var r,n,e,i,o;for(r=[],o=l.forceArray(t),e=0,i=o.length;i>e;e++)n=o[e],l.isNumber(n)&&r.push(n+0);return r},t.changeCase=function(r,e){var i,o,u,s,c,f,p,a,g,h,m;if(s=t.stringsFromArray(e),o=t.numbersFromArray(e),s.length>0&&this.set(n[r].apply(n,[this.string].concat(d.call(s)))),0===o[0]){for(g=[],c=0,p=o.length;p>c;c++)u=o[c],g.push(function(){var t,e,o;for(o=[],i=t=0,e=this.count-1;e>=0?e>=t:t>=e;i=e>=0?++t:--t)o.push(this.words[i]=n[r](this.words[i],u));return o}.call(this));return g}for(e.length<1&&(o=function(){h=[];for(var t=0,r=this.count;r>=0?r>=t:t>=r;r>=0?t++:t--)h.push(t);return h}.apply(this)),m=[],f=0,a=o.length;a>f;f++)i=o[f],i=l.positiveIndex(i,this.count),m.push(this.words[i]=n[r](this.words[i]));return m},t.applyToValidIndex=function(t,r,n){var e;return!1!==(e=l.positiveIndex(t,r))?n(e):void 0},t}(),u=function(t){function r(){this.set.apply(this,arguments)}return y(r,t),r.prototype.set=function(){var t,r,e,i,o,u,c;if(this.words=[],arguments.length<1)return this;for(e=0,o=arguments.length;o>e;e++)for(t=arguments[e],c=n.split(n.create(t),s.delimiter),i=0,u=c.length;u>i;i++)r=c[i],this.words.push(r);return this},r.prototype.get=function(){var t,r,e,i;if(arguments.length<1)return this.words.join(s.delimiter);for(r="",e=0,i=arguments.length;i>e;e++)t=arguments[e],t=l.positiveIndex(t,this.count),t!==!1&&(r+=this.words[t]+s.delimiter);return n.trim(r)},r.prototype.xs=function(t){var r,n,e,i,o,u,s;if(null==t&&(t=function(){return!0}),l.notFunction(t)||this.count<1)return this;for(e=[],s=this.words,r=o=0,u=s.length;u>o;r=++o)i=s[r],(n=t(i,r))&&(n===!0?e.push(i):l.isStringOrNumber(n)&&e.push(n+""));return this.words=e,this},r.prototype.find=function(t){var r;return r=[],""!==(t=l.forceString(t))&&this.xs(function(n,e){return n===t&&r.push(e+1),!0}),r},r.prototype.upper=function(){return s.changeCase.call(this,"upper",Array.prototype.slice.call(arguments)),this},r.prototype.lower=function(){return s.changeCase.call(this,"lower",Array.prototype.slice.call(arguments)),this},r.prototype.reverse=function(){var t,r,e;if(0===(null!=arguments?arguments[0]:void 0))this.xs(function(t){return n.reverse(t)});else if(arguments.length>0)for(r=0,e=arguments.length;e>r;r++)t=arguments[r],s.applyToValidIndex(t,this.count,function(t){return function(r){return t.words[r]=n.reverse(t.words[r])}}(this));else this.xs(function(t){return function(r,n){return t.get(t.count-n)}}(this));return this},r.prototype.shuffle=function(t){var r,e,i,o,u;if(null!=t)if(l.isString(t))for(e=0,o=arguments.length;o>e;e++)r=arguments[e],this.xs(function(){return function(t){return t===r?n.shuffle(t):!0}}(this));else if(0===t)this.xs(function(t){return n.shuffle(t)});else for(i=0,u=arguments.length;u>i;i++)r=arguments[i],s.applyToValidIndex(r,this.count,function(t){return function(r){return t.words[r]=n.shuffle(t.words[r])}}(this));else this.words=l.shuffleArray(this.words);return this},r.prototype.clear=function(){return this.words=[],this},r.prototype.remove=function(){var t,n,e,i,o,u,s;if(arguments.length<1)return this;for(n=[],i=0,u=arguments.length;u>i;i++)t=arguments[i],l.isString(t)?n.unshift(t):l.isNumber(t)&&n.push(r.positiveIndex(t,this.count));for(n=l.noDupAndReverse(l.insertSort(n)),e=o=0,s=n.length;s>o;e=++o)t=n[e],l.isNumber(t)?this.xs(function(){return function(r,n){return n!==t?!0:void 0}}(this)):l.isString(t)&&this.xs(function(r){return r!==t?!0:void 0});return this},r.prototype.pop=function(t){var r,n;for(t=Math.abs(l.forceNumber(t,1)),r=n=1;t>=1?t>=n:n>=t;r=t>=1?++n:--n)this.words.pop();return this},r.prototype.push=function(){var t,r,e;for(r=0,e=arguments.length;e>r;r++)t=arguments[r],""!==(t=l.forceString(t))&&this.words.push(n.trim(t));return this},r.prototype.shift=function(t){var r,n;for(t=l.forceNumber(t,1),r=n=1;t>=1?t>=n:n>=t;r=t>=1?++n:--n)this.words.shift();return this},r.prototype.prepend=function(){var t,r,e,i;for(r=0,e=0,i=arguments.length;i>e;e++)t=arguments[e],""!==(t=l.forceString(t))&&(this.words.splice(r,0,n.trim(t)),r++);return this},r.prototype.insert=function(){var t,r,e,i,o,u;for(t=arguments[0],i=2<=arguments.length?d.call(arguments,1):[],t=l.positiveIndex(t,this.count),r=0,o=0,u=i.length;u>o;o++)e=i[o],""!==(e=l.forceString(e))&&(this.words.splice(t+r,0,n.trim(e)),r++);return this},r.prototype.replace=function(t,r){return null==r&&(r=""),""===(r=n.trim(r))?this:(l.isNumber(t)?s.applyToValidIndex(t,this.count,function(t){return function(n){return t.words.splice(n,1,r)}}(this)):this.xs(function(n){return n===t?r:!0}),this)},r.prototype.sort=function(){return l.insertSort(this.words),this},r.prototype.startsWith=function(t){var n;return""===(t=l.forceString(t))?!1:(n=!0,t=new r(t),t.xs(function(t){return function(r,e){return r!==t.words[e]?n=!1:void 0}}(this)),n)},r.prototype.endsWith=function(t){var n,e,i,o,u;if(""===(t=l.forceString(t)))return!1;for(i=!0,n=1,t=new r(t),e=o=u=t.count;1>=u?1>=o:o>=1;e=1>=u?++o:--o)t.get(e)!==this.words[this.count-n++]&&(i=!1);return i},r}(n),Object.defineProperty(u.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(u.prototype,"string",{get:function(){return this.get()}}),Object.defineProperty(u.prototype,"count",{get:function(){return this.words.length}}),u.prototype.unshift=u.prototype.prepend,u.Strings=n,u.Types=o,u.Chars=t,"undefined"!=typeof window&&null!==window?(window.Types=o,window.Strings=n,window.Words=u):module.exports=u}).call(this); | ||
(function(){"use strict";var t,r,n,e,i,o,u,s,c,f,p,a,g,h,l,m={}.hasOwnProperty,y=function(t,r){function n(){this.constructor=t}for(var e in r)m.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},d=[].slice,v=[].indexOf||function(t){for(var r=0,n=this.length;n>r;r++)if(r in this&&this[r]===t)return r;return-1};p=function(t,r){return r instanceof t},h=function(t,r){return null==r&&(r="object"),typeof t===r},r={Boolean:!1,String:"",Object:{},Array:[],Function:function(){},Number:function(){var t;return t=new Number,t["void"]=!0,t}()},i={Undefined:function(t){return void 0===t},Null:function(t){return null===t},Function:function(t){return h(t,"function")},Boolean:function(t){return h(t,"boolean")},String:function(t){return h(t,"string")},Array:function(t){return h(t)&&p(Array,t)},RegExp:function(t){return h(t)&&p(RegExp,t)},Date:function(t){return h(t)&&p(Date,t)},Number:function(t){return h(t,"number")&&t===t||h(t)&&p(Number,t)},Object:function(t){return!(!h(t)||null===t||p(Boolean,t)||p(Number,t)||p(Array,t)||p(RegExp,t)||p(Date,t))},NaN:function(t){return h(t,"number")&&t!==t},Defined:function(t){return void 0!==t}},i.StringOrNumber=function(t){return i.String(t)||i.Number(t)},o=l={parseIntBase:10},f=function(t){var n;return n=function(r){switch(t){case"Number":if(l.isNumber(r=parseInt(r,l.parseIntBase))&&!r["void"])return r;break;case"String":if(l.isStringOrNumber(r))return r+"";break;default:if(o["is"+t](r))return r}},function(e,i){return null!=e&&void 0!==(e=n(e))?e:null!=i&&void 0!==(i=n(i))?i:r[t]}},g=function(t,r,n){var e,o,u;if(null==n&&(n=[]),n.length<1)return t===i.Undefined;for(o=0,u=n.length;u>o;o++)if(e=n[o],t(e)===r)return r;return!r},c=!0,function(){var t,n,e;e=[];for(t in i)n=i[t],e.push(function(t,n){return o["is"+t]=n,o["not"+t]=function(t){return!n(t)},o["has"+t]=function(){return g(n,c,arguments)},o["all"+t]=function(){return g(n,!c,arguments)},t in r?o["force"+t]=f(t):void 0}(t,n));return e}(),o["typeof"]=function(t){var r,n;for(r in i)if(n=i[r],n(t)===!0)return r.toLowerCase()},a=function(t){var r,n,e,i,o;if(l.notArray(t))return 0;for(r=i=0,o=t.length;o>i;r=++i){if(e=t[r],n=l.forceNumber(e),n["void"])return r;t[r]=n}return t.length},l=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return y(r,t),r.flexArgs=function(){var t;return t=1<=arguments.length?d.call(arguments,0):[],t.length<2&&(r.isString(t[0])?t=n.split(t.join(" ")):r.isArray(t[0])&&(t=t[0])),t},r.inRange=function(t,n){return r.isNaN(t=parseInt(t,10))||a(n)<2?!1:t>=n[0]&&t<=n[1]},r.limitNumber=function(t,n){return t=r.forceNumber(t,0),a(n)<2?t:t<n[0]?n[0]:t>n[1]?n[1]:t},r.randomNumber=function(t,r){return a([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}(o),t=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return y(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(l.forceNumber(t))},r.ordinal=function(t){return l.forceNumber(l.forceString(t).charCodeAt(),0)},r.random=function(t){var n,e;return t=l.forceArray(t,r.ASCII_RANGE_ALL),e=l.limitNumber(t[0],t),n=l.limitNumber(t[1],t),r.ascii(l.randomNumber(e,n))},r}(l),e=function(){function t(){}return t.changeCase=function(){var t,r,e,i,o,u,s,c,f;if(o=arguments[0],e=arguments[1],r=3<=arguments.length?d.call(arguments,2):[],null==o&&(o=""),""===(o=l.forceString(o)))return o;if(r.length<1||void 0===r[0])return o[e]();if(l.isNumber(r[0]))for(u=0,c=r.length;c>u;u++)t=r[u],i=l.positiveIndex(t,o.length),o=n.xs(o,function(t,r){return r===i?t[e]():t});else if(l.isString(r[0]))for(s=0,f=r.length;f>s;s++)t=r[s],o=n.replace(o,t,t[e](),"gi");return o},t}(),n=function(r){function n(){this.set.apply(this,arguments),this.wrapMethod=null,this.crop=this.slice}return y(n,r),n.create=function(){var t,r,n,e;for(r="",n=0,e=arguments.length;e>n;n++)t=arguments[n],r+=l.forceString(t);return r},n.get=function(){var t,r,n,e,i,o,u;if(o=arguments[0],e=2<=arguments.length?d.call(arguments,1):[],arguments.length<2)return"";for(o=l.forceString(o),r=o.length,i="",t=arguments.length,n=u=1;t>=1?t>=u:u>=t;n=t>=1?++u:--u)n=l.positiveIndex(arguments[n],r),n!==!1&&(i+=o[n]);return i},n.sort=function(t){return t=l.forceString(t).trim().split(""),l.insertSort(t).join("")},n.random=function(r,n){var e,i,o;for(r=l.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=l.forceString(t)))return"";for(r=l.forceNumber(r,1),n="";r-->0;)n+=t;return n},n.regEscape=function(r){return""===(r=l.forceString(r))?r:n.xs(r,function(r){return v.call(t.REGEXP_SPECIAL_CHARS,r)>=0?"\\"+r:!0})},n.empty=function(t){return l.notString(t)||t.length>0?!1:!0},n.isAlpha=function(t){return""===(t=l.forceString(t))?!1:/^[a-z]*$/gi.test(t)},n.isNumeric=function(t){return""===(t=l.forceString(t))?!1:/^[0-9]*$/g.test(t)},n.isAlphaNumeric=function(t){return""===(t=l.forceString(t))?!1:/^[0-9|a-z]*$/gi.test(t)},n.isSpecial=function(t){return""===(t=l.forceString(t))?!1:/^[^0-9|a-z]*$/gi.test(t)},n.isSpace=function(t){return/^[ \t]+$/g.test(t)},n.hasUpper=function(t){return/[A-Z]+/g.test(t)},n.isUpper=function(t){return/^[A-Z]+$/g.test(t)},n.isLower=function(t){return/^[a-z]+$/g.test(t)},n.xs=function(t,r){var n,e,i,o,u;if(null==t&&(t=""),t=l.forceString(t),-1===(e=t.length-1))return"";for(r=l.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]:l.isStringOrNumber(i)&&(o+=i));return o},n.copy=function(t,r,n){return r=l.forceNumber(r),""===(t=l.forceString(t))||Math.abs(r)>t.length?"":(r>0&&(r-=1),t.substr(r,l.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"),!l.isStringOrNumber(t)||"string"!==(o=l["typeof"](r))&&"number"!==o&&"regexp"!==o?l.forceString(t):(l.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=l.forceString(t),r=l.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=l.forceString(t),r=l.forceString(r,"-"),n.replace(t,/([A-Z])/g,r+"$1").toLowerCase()},n.shuffle=function(t){return t=l.forceString(t),l.shuffleArray((t+"").split("")).join("")},n.find=function(t,r,e){var i,o;if(i=[],""===(t=l.forceString(t)))return i;if(e=l.forceString(e,"g"),l.isStringOrNumber(r))r=new RegExp(n.regEscape(r+""),e);else{if(!l.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 l.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=l.forceString(t),r=l.forceNumber(r||1),!1!==(r=l.positiveIndex(r,t.length))?(n=l.forceNumber(n),t.slice(r,r+n)):""},n.truncate=function(t,r,e){return t=l.forceString(t),r=l.forceNumber(r,t.length),t=n.slice(t,1,r),t+l.forceString(e)},n.pop=function(t,r){return t=l.forceString(t),r=l.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=l.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=l.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?d.call(arguments,1):[],e.changeCase.apply(e,[r,"toUpperCase"].concat(d.call(t)))},n.lower=function(){var t,r;return r=arguments[0],t=2<=arguments.length?d.call(arguments,1):[],e.changeCase.apply(e,[r,"toLowerCase"].concat(d.call(t)))},n.insert=function(){var t,r,n,e,i,o;if(i=arguments[0],r=arguments[1],e=3<=arguments.length?d.call(arguments,2):[],""===(i=l.forceString(i))||""===(r=l.forceString(r)))return i;if(e=l.sortNoDupAndReverse(e,i.length),n=a(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=l.forceString(t),""===t||!1===(r=l.positiveIndex(r,t.length))||0>(e=l.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?d.call(arguments,1):[],""===(e=l.forceString(e))?"":(t=r.map(function(t){return l.positiveIndex(t,e.length)}),n.xs(e,function(r,n){return v.call(t,n)>=0?void 0:!0}))},n.remove=function(){var t,r,e,i,o;if(r=arguments[0],e=2<=arguments.length?d.call(arguments,1):[],null==r&&(r=""),""===(r=l.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=l.forceString(t))||""===(r=l.forceString(r))?!1:(r=new RegExp("^"+n.regEscape(r)),r.test(t))},n.endsWith=function(t,r){return""===(t=l.forceString(t))||""===(r=l.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=l.forceString(n)+t,r+=l.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=l.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.isUpper=function(){return n.isUpper(this.string)},n.prototype.hasUpper=function(){return n.hasUpper(this.string)},n.prototype.isLower=function(){return n.isLower(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?d.call(arguments,1):[],this.string=n.insert.apply(n,[this.string,r].concat(d.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?d.call(arguments,0):[],this.string=n.remove.apply(n,[this.string].concat(d.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?d.call(arguments,0):[],this.string=n.removePos.apply(n,[this.string].concat(d.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?d.call(arguments,0):[],this.string=n.upper.apply(n,[this.string].concat(d.call(t))),this},n.prototype.lower=function(){var t;return t=1<=arguments.length?d.call(arguments,0):[],this.string=n.lower.apply(n,[this.string].concat(d.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 l.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(n.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(n.prototype,"length",{get:function(){return this.string.length}}),Object.defineProperty(n.prototype,"wrap",{get:function(){return l.isNull(this.wrapMethod)?this.string:this.wrapMethod(this.string)}}),n.Types=o,n.Chars=t,n.crop=n.slice,n.prototype.crop=n.prototype.slice,n.prototype.append=n.prototype.push,s=function(){function t(){}return t.delimiter=" ",t.stringsFromArray=function(t){var r,n,e,i,o;for(r=[],o=l.forceArray(t),e=0,i=o.length;i>e;e++)n=o[e],l.isString(n)&&r.push(n);return r},t.numbersFromArray=function(t){var r,n,e,i,o;for(r=[],o=l.forceArray(t),e=0,i=o.length;i>e;e++)n=o[e],l.isNumber(n)&&r.push(n+0);return r},t.changeCase=function(r,e){var i,o,u,s,c,f,p,a,g,h,m;if(s=t.stringsFromArray(e),o=t.numbersFromArray(e),s.length>0&&this.set(n[r].apply(n,[this.string].concat(d.call(s)))),0===o[0]){for(g=[],c=0,p=o.length;p>c;c++)u=o[c],g.push(function(){var t,e,o;for(o=[],i=t=0,e=this.count-1;e>=0?e>=t:t>=e;i=e>=0?++t:--t)o.push(this.words[i]=n[r](this.words[i],u));return o}.call(this));return g}for(e.length<1&&(o=function(){h=[];for(var t=0,r=this.count;r>=0?r>=t:t>=r;r>=0?t++:t--)h.push(t);return h}.apply(this)),m=[],f=0,a=o.length;a>f;f++)i=o[f],i=l.positiveIndex(i,this.count),m.push(this.words[i]=n[r](this.words[i]));return m},t.applyToValidIndex=function(t,r,n){var e;return!1!==(e=l.positiveIndex(t,r))?n(e):void 0},t}(),u=function(t){function r(){this.set.apply(this,arguments)}return y(r,t),r.prototype.set=function(){var t,r,e,i,o,u,c,f;if(r=1<=arguments.length?d.call(arguments,0):[],this.words=[],r=l.flexArgs.apply(this,r),r.length<1)return this;for(i=0,u=r.length;u>i;i++)for(t=r[i],f=n.split(n.create(t),s.delimiter),o=0,c=f.length;c>o;o++)e=f[o],this.words.push(e);return this},r.prototype.get=function(){var t,r,e,i;if(arguments.length<1)return this.words.join(s.delimiter);for(r="",e=0,i=arguments.length;i>e;e++)t=arguments[e],t=l.positiveIndex(t,this.count),t!==!1&&(r+=this.words[t]+s.delimiter);return n.trim(r)},r.prototype.xs=function(t){var r,n,e,i,o,u,s;if(null==t&&(t=function(){return!0}),l.notFunction(t)||this.count<1)return this;for(e=[],s=this.words,r=o=0,u=s.length;u>o;r=++o)i=s[r],(n=t(i,r))&&(n===!0?e.push(i):l.isStringOrNumber(n)&&e.push(n+""));return this.words=e,this},r.prototype.find=function(t){var r;return r=[],""!==(t=l.forceString(t))&&this.xs(function(n,e){return n===t&&r.push(e+1),!0}),r},r.prototype.upper=function(){return s.changeCase.call(this,"upper",Array.prototype.slice.call(arguments)),this},r.prototype.lower=function(){return s.changeCase.call(this,"lower",Array.prototype.slice.call(arguments)),this},r.prototype.reverse=function(){var t,r,e;if(0===(null!=arguments?arguments[0]:void 0))this.xs(function(t){return n.reverse(t)});else if(arguments.length>0)for(r=0,e=arguments.length;e>r;r++)t=arguments[r],s.applyToValidIndex(t,this.count,function(t){return function(r){return t.words[r]=n.reverse(t.words[r])}}(this));else this.xs(function(t){return function(r,n){return t.get(t.count-n)}}(this));return this},r.prototype.shuffle=function(t){var r,e,i,o,u;if(null!=t)if(l.isString(t))for(e=0,o=arguments.length;o>e;e++)r=arguments[e],this.xs(function(){return function(t){return t===r?n.shuffle(t):!0}}(this));else if(0===t)this.xs(function(t){return n.shuffle(t)});else for(i=0,u=arguments.length;u>i;i++)r=arguments[i],s.applyToValidIndex(r,this.count,function(t){return function(r){return t.words[r]=n.shuffle(t.words[r])}}(this));else this.words=l.shuffleArray(this.words);return this},r.prototype.clear=function(){return this.words=[],this},r.prototype.remove=function(){var t,n,e,i,o,u,s;if(arguments.length<1)return this;for(n=[],i=0,u=arguments.length;u>i;i++)t=arguments[i],l.isString(t)?n.unshift(t):l.isNumber(t)&&n.push(r.positiveIndex(t,this.count));for(n=l.noDupAndReverse(l.insertSort(n)),e=o=0,s=n.length;s>o;e=++o)t=n[e],l.isNumber(t)?this.xs(function(){return function(r,n){return n!==t?!0:void 0}}(this)):l.isString(t)&&this.xs(function(r){return r!==t?!0:void 0});return this},r.prototype.pop=function(t){var r,n,e,i;for(t=Math.abs(l.forceNumber(t,1)),e="",r=i=1;t>=1?t>=i:i>=t;r=t>=1?++i:--i)n=this.words.pop(),void 0!==n&&(e=n+" "+e);return e.trim()},r.prototype.push=function(){var t,r,e;for(r=0,e=arguments.length;e>r;r++)t=arguments[r],""!==(t=l.forceString(t))&&this.words.push(n.trim(t));return this},r.prototype.shift=function(t){var r,n;for(t=l.forceNumber(t,1),r=n=1;t>=1?t>=n:n>=t;r=t>=1?++n:--n)this.words.shift();return this},r.prototype.prepend=function(){var t,r,e,i;for(r=0,e=0,i=arguments.length;i>e;e++)t=arguments[e],""!==(t=l.forceString(t))&&(this.words.splice(r,0,n.trim(t)),r++);return this},r.prototype.insert=function(){var t,r,e,i,o,u;for(t=arguments[0],i=2<=arguments.length?d.call(arguments,1):[],t=l.positiveIndex(t,this.count),r=0,o=0,u=i.length;u>o;o++)e=i[o],""!==(e=l.forceString(e))&&(this.words.splice(t+r,0,n.trim(e)),r++);return this},r.prototype.replace=function(t,r){return null==r&&(r=""),""===(r=n.trim(r))?this:(l.isNumber(t)?s.applyToValidIndex(t,this.count,function(t){return function(n){return t.words.splice(n,1,r)}}(this)):this.xs(function(n){return n===t?r:!0}),this)},r.prototype.sort=function(){return l.insertSort(this.words),this},r.prototype.startsWith=function(t){var n;return""===(t=l.forceString(t))?!1:(n=!0,t=new r(t),t.xs(function(t){return function(r,e){return r!==t.words[e]?n=!1:void 0}}(this)),n)},r.prototype.endsWith=function(t){var n,e,i,o,u;if(""===(t=l.forceString(t)))return!1;for(i=!0,n=1,t=new r(t),e=o=u=t.count;1>=u?1>=o:o>=1;e=1>=u?++o:--o)t.get(e)!==this.words[this.count-n++]&&(i=!1);return i},r}(n),Object.defineProperty(u.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(u.prototype,"string",{get:function(){return this.get()}}),Object.defineProperty(u.prototype,"count",{get:function(){return this.words.length}}),u.prototype.unshift=u.prototype.prepend,u.Strings=n,u.Types=o,u.Chars=t,"undefined"!=typeof window&&null!==window?(window.Types=o,window.Strings=n,window.Words=u):module.exports=u}).call(this); |
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
304730
4926
498