Comparing version 0.3.8 to 0.3.9
{ | ||
"name": "words.js", | ||
"version": "0.3.8", | ||
"description": "A library/toolbox for working with words in a string.", | ||
"version": "0.3.9", | ||
"description": "A library/toolbox for working with words and strings.", | ||
"main": "words.min.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
words.js | ||
======== | ||
**words.js** is a library/toolbox for working with words in a string. Great for handling command-line or text input, | ||
**words.js** is a library/toolbox for working with strings and words. Great for handling command-line or text input, | ||
educational tools, word-games, text filters, password generators, etc.. | ||
@@ -25,3 +25,3 @@ <br/> | ||
words.set('or reverse or remove specific words and sort?') | ||
.reverse(2, -1).remove('or', 'remove').replace.sort(); | ||
.reverse(2, -1).remove('or', 'remove').sort(); | ||
console.log( words.$ ); | ||
@@ -79,3 +79,3 @@ // ?tros and esrever specific words | ||
paths: { | ||
'types', [ '../path/to/types.min' ] | ||
'types', [ 'path/to/types.min(.js)' ] | ||
} | ||
@@ -119,27 +119,10 @@ }); | ||
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: | ||
***- DEPRECATED!! -*** | ||
type |input |result | ||
------------------------|--------------------------|-------------- | ||
space delimited strings |'top left width' |['top', 'left', 'width'] | ||
multiple arguments |'top', 'left', 'width' |['top', 'left', 'width'] | ||
array |['top', 'left', 'width'] |['top', 'left', 'width'] | ||
Use .intoArray instead of .flexArgs. | ||
Each generating the same result. | ||
```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' ] | ||
.flexArgs has been renamed to 'intoArray' and is now part of the included types.js. .intoArray is 100% compatible, | ||
it shouldn't break any code. .flexArgs still works, but it will be removed from words.js eventually. | ||
testArgs( ['a', 'b', 'c'] ); | ||
// [ 'a', 'b', 'c' ] | ||
testArgs( 'a b c' ); | ||
// [ 'a', 'b', 'c' ] | ||
``` | ||
See types.js .intoArray for a description. | ||
___ | ||
@@ -177,5 +160,7 @@ **Words.prototype.words** | ||
**Words.prototype.set** | ||
> `<this> set( <flexArgs> string1, ..., stringN )` | ||
> `<this> set( <string> string1, ..., stringN )` | ||
> Set this.words with string(s). The strings can be given in the 3 flexArgs forms, see .flexArgs description on top of the API. | ||
> Set this.words with string(s). The strings can be given in the 3 (types.js) .intoArray forms, see .intoArray | ||
description in types.js. | ||
> Use any combination of arguments to form a string. All invalid arguments will be ignored. | ||
@@ -448,2 +433,9 @@ | ||
========== | ||
**0.3.9** | ||
Updated the included types.js to version 1.5.0. | ||
Deprecated .flexArgs. .flexArgs is now included (in the included) types.js and has been renamed to .intoArray. | ||
So, use .intoArray instead of .flexArgs which will be removed at some point in time. | ||
___ | ||
**0.3.8** | ||
@@ -450,0 +442,0 @@ |
43
words.js
@@ -1,8 +0,7 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
"use strict"; | ||
var Chars, LITERALS, Strings, Strings_, TYPES, Types, Words, Words_, breakIfEqual, createForce, instanceOf, mapStringToNumber, testValues, typeOf, _, | ||
__slice = [].slice, | ||
__hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
__slice = [].slice, | ||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
@@ -156,2 +155,15 @@ | ||
Types.intoArray = function() { | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
if (args.length < 2) { | ||
if (_.isString(args[0])) { | ||
args = args.join('').replace(/^\s+|\s+$/g, '').replace(/\s+/g, ' ').split(' '); | ||
} else if (_.isArray(args[0])) { | ||
args = args[0]; | ||
} | ||
} | ||
return args; | ||
}; | ||
Types["typeof"] = function(value) { | ||
@@ -190,15 +202,2 @@ var name, predicate; | ||
_.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) { | ||
@@ -1219,3 +1218,3 @@ if ((_.isNaN(nr = parseInt(nr, 10))) || (mapStringToNumber(range) < 2)) { | ||
this.words = []; | ||
args = _.flexArgs.apply(this, args); | ||
args = _.intoArray.apply(this, args); | ||
if (args.length < 1) { | ||
@@ -1549,2 +1548,4 @@ return this; | ||
Words.flexArgs = Types.intoArray; | ||
Words.Strings = Strings; | ||
@@ -1556,13 +1557,11 @@ | ||
if (('function' === typeof define) && define.amd) { | ||
if ((typeof define !== "undefined" && define !== null) && ('function' === typeof define) && define.amd) { | ||
define('words', [], function() { | ||
return Words; | ||
}); | ||
} | ||
if (typeof window !== "undefined" && window !== null) { | ||
} else if (typeof window !== "undefined" && window !== null) { | ||
window.Words = Words; | ||
window.Types = Types; | ||
window.Strings = Strings; | ||
window.Words = Words; | ||
} else { | ||
} else if (typeof module !== "undefined" && module !== null) { | ||
module.exports = Words; | ||
@@ -1569,0 +1568,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.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,"function"==typeof define&&define.amd&&define("words",[],function(){return u}),"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=[].slice,y={}.hasOwnProperty,d=function(t,r){function n(){this.constructor=t}for(var e in r)y.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},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.intoArray=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],t.length<2&&(l.isString(t[0])?t=t.join("").replace(/^\s+|\s+$/g,"").replace(/\s+/g," ").split(" "):l.isArray(t[0])&&(t=t[0])),t},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 d(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 d(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?m.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 d(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?m.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?m.call(arguments,1):[],e.changeCase.apply(e,[r,"toUpperCase"].concat(m.call(t)))},n.lower=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],e.changeCase.apply(e,[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=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?m.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?m.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?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 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,y;if(s=t.stringsFromArray(e),o=t.numbersFromArray(e),s.length>0&&this.set(n[r].apply(n,[this.string].concat(m.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)),y=[],f=0,a=o.length;a>f;f++)i=o[f],i=l.positiveIndex(i,this.count),y.push(this.words[i]=n[r](this.words[i]));return y},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 d(r,t),r.prototype.set=function(){var t,r,e,i,o,u,c,f;if(r=1<=arguments.length?m.call(arguments,0):[],this.words=[],r=l.intoArray.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?m.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.flexArgs=o.intoArray,u.Strings=n,u.Types=o,u.Chars=t,"undefined"!=typeof define&&null!==define&&"function"==typeof define&&define.amd?define("words",[],function(){return u}):"undefined"!=typeof window&&null!==window?(window.Words=u,window.Types=o,window.Strings=n):"undefined"!=typeof module&&null!==module&&(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
305882
4930
516