strings.js
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "strings.js", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "A flexible, robust and powerful Javascript string manipulation library.", | ||
@@ -5,0 +5,0 @@ "main": "strings.min.js", |
@@ -749,33 +749,18 @@ strings.js | ||
___________________ | ||
Inherited functions | ||
------------------- | ||
###Tools and imports from my other libraries: | ||
_________________ | ||
**From chars.js** ( to be found in the phazelift repositories ) | ||
_________________ | ||
**Strings.ASCII_RANGE_UPPERCASE** | ||
> `<array> Strings.ASCII_RANGE_UPPERCASE` | ||
**Strings.ASCII_RANGE_...** | ||
> An array with two indexes: [0] is the bottom of range, [1] is the top of range of the ordinal | ||
> value of uppercase ascii characters. | ||
|Range |Ordinal range |Characters found in range | ||
|:----------------------------------|--------------|:----------------------------- | ||
|Strings.ASCII_RANGE_UPPERCASE |[65,90] |`ABCDEFGHIJKLMNOPQRSTUVWXYZ` | ||
|Strings.ASCII_RANGE_LOWERCASE |[97,122] |`abcdefghijklmnopqrstuvwxyz` | ||
|Strings.ASCII_RANGE_NUMBERS |[48,57] |`0123456789` | ||
|Strings.ASCII_RANGE_SPECIAL_1 |[32,47] |` !"#$%&'()*+,-./` | ||
|Strings.ASCII_RANGE_SPECIAL_2 |[58,64] |`:;<=>?@` | ||
|Strings.ASCII_RANGE_SPECIAL_3 |[91,96] |`[\]^_`\` | ||
|Strings.ASCII_RANGE_SPECIAL_4 |[123,126] |`{|}~` | ||
|Strings.ASCII_RANGE_ALL(printable) |[32,126] |` !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`\``abcdefghijklmnopqrstuvwxyz{|}~` | ||
**Strings.ASCII_RANGE_LOWERCASE** | ||
> `<array> Strings.ASCII_RANGE_LOWERCASE` | ||
> An array with two indexes: [0] is the bottom of range, [1] is the top of range of the ordinal | ||
> value of lowercase ascii characters. | ||
**Strings.ASCII_RANGE_NUMBERS** | ||
> `<array> Strings.ASCII_RANGE_NUMBERS` | ||
> An array with two indexes: [0] is the bottom of range, [1] is the top of range of the ordinal | ||
> value of ascii number characters. | ||
**Strings.ASCII_RANGE_ALL** | ||
> `<array> Strings.ASCII_RANGE_ALL` | ||
> An array with two indexes: [0] is the bottom of range, [1] is the top of range of the ordinal | ||
> value of all 'printable' ascii characters. | ||
**Strings.REGEXP_SPECIAL_CHARS** | ||
@@ -796,12 +781,2 @@ > `<array> Strings.REGEXP_SPECIAL_CHARS` | ||
**Strings.isUpper** | ||
> `Strings.isUpper( <string> char )` | ||
> Returns true if char is uppercase. | ||
**Strings.isLower** | ||
> `Strings.isLower( <string> char )` | ||
> Returns true if char is lowercase. | ||
**Strings.random** | ||
@@ -812,7 +787,3 @@ >`Strings.random( asciiRange= Strings.ASCII_RANGE_ALL )` | ||
_________________ | ||
**From tools.js** ( to be found in the phazelift repositories now or soon ) | ||
_________________ | ||
**Strings.inRange** | ||
@@ -855,5 +826,5 @@ > `<boolean> Strings.inRange( <string>/<number> nr, <array> range )` | ||
_________________ | ||
**From types.js** ( to be found in phazelift repositories ) | ||
##types.js | ||
> The entire library (1.8kb) is included in strings.js. Check the repo for general info and API. | ||
> The full library (1.8kb) is included in strings.js. Check my phazelift repository for general info and API. | ||
@@ -860,0 +831,0 @@ |
@@ -1091,4 +1091,2 @@ // Generated by CoffeeScript 1.8.0 | ||
console.log(new Strings('!@ #$').isSpecial()); | ||
if (typeof window !== "undefined" && window !== null) { | ||
@@ -1095,0 +1093,0 @@ window.Strings = Strings; |
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";var t,r,n,e,i,o,u,s,c,f,a,p,g,l={}.hasOwnProperty,h=function(t,r){function n(){this.constructor=t}for(var e in r)l.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},m=[].slice,y=[].indexOf||function(t){for(var r=0,n=this.length;n>r;r++)if(r in this&&this[r]===t)return r;return-1};s=function(){var t;return t=new Number,t["void"]=!0,t},n={parseIntBase:10},c={Boolean:!1,String:"",Number:s(),Object:{},Array:[],Function:function(){}},u=function(t){var r;return r=function(r){switch(t){case"Number":if(n.isNumber(r=parseInt(r,n.parseIntBase)))return r;break;case"String":if(n.isStringOrNumber(r))return r+"";break;default:if(n["is"+t](r))return r}return!1},function(n,e){return!1!==(n=r(n))?n:!1!==(e=r(e))?e:c[t]}},a=function(t,r,n){var e,i,o;if(null==n&&(n=[]),n.length<1)return t===p.Undefined?!0:!1;for(i=0,o=n.length;o>i;i++)if(e=n[i],t(e)===r)return r;return!r},p={Undefined:function(t){return void 0===t},Null:function(t){return null===t},Boolean:function(t){return"boolean"==typeof t},String:function(t){return"string"==typeof t},Function:function(t){return"function"==typeof t},Number:function(t){return"number"==typeof t&&t===t||"object"==typeof t&&t instanceof Number&&t["void"]},Array:function(t){return"object"==typeof t&&t instanceof Array},RegExp:function(t){return"object"==typeof t&&t instanceof RegExp},Date:function(t){return"object"==typeof t&&t instanceof Date},Object:function(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof RegExp||t instanceof Date)},NaN:function(t){return"number"==typeof t&&t!==t},Defined:function(t){return void 0!==t}},p.StringOrNumber=function(t){return p.String(t)||p.Number(t)},i=!0,function(){var t,r,e;e=[];for(t in p)r=p[t],e.push(function(t,r){return n["is"+t]=r,n["not"+t]=function(t){return!r(t)},n["has"+t]=function(){return a(r,i,arguments)},n["all"+t]=function(){return a(r,!i,arguments)},t in c?n["force"+t]=u(t):void 0}(t,r));return e}(),n["typeof"]=function(t){var r,n;for(n in p)if(r=p[n],r(t)===!0)return n.toLowerCase();return"unknown"},f=function(t){var r,n,e,i,o;if(g.notArray(t))return 0;for(r=i=0,o=t.length;o>i;r=++i){if(e=t[r],n=g.forceNumber(e),n["void"])return r;t[r]=n}return t.length},g=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return h(r,t),r.inRange=function(t,n){return r.isNaN(t=parseInt(t,10))||f(n)<2?!1:t>=n[0]&&t<=n[1]},r.limitNumber=function(t,n){return t=r.forceNumber(t,0),f(n)<2?t:t<n[0]?n[0]:t>n[1]?n[1]:t},r.randomNumber=function(t,r){return f([t,r])<2?0:t>r?t:(r=r-t+1,Math.floor(Math.random()*r+t))},r.shuffleArray=function(t){var n,e,i,o,u;if(r.notArray(t)||t.length<1)return[];for(e=t.length-1,n=u=e;0>=e?0>=u:u>=0;n=0>=e?++u:--u)i=r.randomNumber(0,n),o=t[n],t[n]=t[i],t[i]=o;return t},r.positiveIndex=function(t,n){return 0===(t=r.forceNumber(t,0))?!1:(n=Math.abs(r.forceNumber(n)),Math.abs(t)<=n?t>0?t-1:n+t:!1)},r.insertSort=function(t){var r,n,e,i,o;for(e=t.length-1,n=o=1;e>=1?e>=o:o>=e;n=e>=1?++o:--o){for(r=t[n],i=n-1;i>=0&&t[i]>r;)t[i+1]=t[i],--i;t[+i+1]=r}return t},r.noDupAndReverse=function(t){var r,n,e,i;for(n=t.length-1,e=[],r=i=n;0>=n?0>=i:i>=0;r=0>=n?++i:--i)e[e.length-1]!==t[r]&&e.push(t[r]);return e},r.sortNoDupAndReverse=function(t,n){var e,i,o,u,s;for(i=[],e=u=0,s=t.length;s>u;e=++u)o=t[e],o=r.forceNumber(o),o["void"]||(n>=o&&(o=r.positiveIndex(o,n)),i.push(r.forceNumber(o,0)));return r.noDupAndReverse(r.insertSort(i))},r}(n),t=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return h(r,t),r.ASCII_RANGE_UPPERCASE=[65,90],r.ASCII_RANGE_LOWERCASE=[97,122],r.ASCII_RANGE_NUMBERS=[48,57],r.ASCII_RANGE_SPECIAL_1=[32,47],r.ASCII_RANGE_SPECIAL_2=[58,64],r.ASCII_RANGE_SPECIAL_3=[91,96],r.ASCII_RANGE_SPECIAL_4=[123,126],r.ASCII_RANGE_ALL=[32,126],r.REGEXP_SPECIAL_CHARS=["?","\\","[","]","(",")","*","+",".","/","|","^","$","<",">","-","&"],r.ascii=function(t){return String.fromCharCode(g.forceNumber(t))},r.ordinal=function(t){return g.forceNumber(g.forceString(t).charCodeAt(),0)},r.random=function(t){var n,e;return t=g.forceArray(t,r.ASCII_RANGE_ALL),e=g.limitNumber(t[0],t),n=g.limitNumber(t[1],t),r.ascii(g.randomNumber(e,n))},r}(g),o=function(){var t,n,e,i,o,u,s,c,f;if(o=arguments[0],e=arguments[1],n=3<=arguments.length?m.call(arguments,2):[],null==o&&(o=""),""===(o=g.forceString(o)))return o;if(n.length<1||void 0===n[0])return o[e]();if(g.isNumber(n[0]))for(u=0,c=n.length;c>u;u++)t=n[u],i=g.positiveIndex(t,o.length),o=r.xs(o,function(t,r){return r===i?t[e]():t});else if(g.isString(n[0]))for(s=0,f=n.length;f>s;s++)t=n[s],o=r.replace(o,t,t[e](),"gi");return o},e=function(t,r){var n,e,i;if(""===(t=g.forceString(t)))return!1;for(e=0,i=t.length;i>e;e++)if(n=t[e],!r(n))return!1;return!0},r=function(r){function n(){this.set.apply(this,arguments),this.wrapMethod=null,this.crop=this.slice}return h(n,r),n.create=function(){var t,r,n,e;for(r="",n=0,e=arguments.length;e>n;n++)t=arguments[n],r+=g.forceString(t);return r},n.get=function(){var t,r,n,e,i,o,u;if(o=arguments[0],e=2<=arguments.length?m.call(arguments,1):[],arguments.length<2)return"";for(o=g.forceString(o),r=o.length,i="",t=arguments.length,n=u=1;t>=1?t>=u:u>=t;n=t>=1?++u:--u)n=g.positiveIndex(arguments[n],r),n!==!1&&(i+=o[n]);return i},n.sort=function(t){return t=g.forceString(t).trim().split(""),g.insertSort(t).join("")},n.random=function(r,n){var e,i,o;for(r=g.forceNumber(r,1),i="",e=o=1;r>=1?r>=o:o>=r;e=r>=1?++o:--o)i+=t.random(n);return i},n.times=function(t,r){var n;if(""===(t=g.forceString(t)))return"";for(r=g.forceNumber(r,1),n="";r-->0;)n+=t;return n},n.regEscape=function(r){return""===(r=g.forceString(r))?r:n.xs(r,function(r){return y.call(t.REGEXP_SPECIAL_CHARS,r)>=0?"\\"+r:!0})},n.empty=function(t){return g.notString(t)||t.length>0?!1:!0},n.isAlpha=function(t){return""===(t=g.forceString(t))?!1:/^[a-z]*$/gi.test(t)},n.isNumeric=function(t){return""===(t=g.forceString(t))?!1:/^[0-9]*$/g.test(t)},n.isAlphaNumeric=function(t){return""===(t=g.forceString(t))?!1:/^[0-9|a-z]*$/gi.test(t)},n.isSpecial=function(t){return""===(t=g.forceString(t))?!1:/^[^0-9|a-z]*$/gi.test(t)},n.isSpace=function(t){return/^[ \t]+$/g.test(t)},n.xs=function(t,r){var n,e,i,o,u;if(null==t&&(t=""),t=g.forceString(t),-1===(e=t.length-1))return"";for(r=g.forceFunction(r,function(t){return t}),o="",n=u=0;e>=0?e>=u:u>=e;n=e>=0?++u:--u)(i=r(t[n],n))&&(i===!0?o+=t[n]:g.isStringOrNumber(i)&&(o+=i));return o},n.copy=function(t,r,n){return r=g.forceNumber(r),""===(t=g.forceString(t))||Math.abs(r)>t.length?"":(r>0&&(r-=1),t.substr(r,g.forceNumber(n,t.length)))},n.replace=function(t,r,e,i){var o;return null==t&&(t=""),null==r&&(r=""),null==e&&(e=""),null==i&&(i="g"),!g.isStringOrNumber(t)||"string"!==(o=g["typeof"](r))&&"number"!==o&&"regexp"!==o?g.forceString(t):(g.notRegExp(r)&&(r=n.regEscape(r+""),r=new RegExp(r,i)),(t+"").replace(r,e))},n.trim=function(t){return n.replace(t,/^\s+|\s+$/g)},n.trimLeft=function(t){return n.replace(t,/^\s+/g)},n.trimRight=function(t){return n.replace(t,/\s+$/g)},n.oneSpace=function(t){return n.replace(t,/\s+/g," ")},n.oneSpaceAndTrim=function(t){return n.oneSpace(n.trim(t))},n.toCamel=function(t,r){var e;return t=g.forceString(t),r=g.forceString(r,"-"),e=new RegExp(n.regEscape(r)+"([a-z])","ig"),n.replace(t,e,function(t,r){return r.toUpperCase()})},n.unCamel=function(t,r){return t=g.forceString(t),r=g.forceString(r,"-"),n.replace(t,/([A-Z])/g,r+"$1").toLowerCase()},n.shuffle=function(t){return t=g.forceString(t),g.shuffleArray((t+"").split("")).join("")},n.find=function(t,r,e){var i,o;if(i=[],""===(t=g.forceString(t)))return i;if(e=g.forceString(e,"g"),g.isStringOrNumber(r))r=new RegExp(n.regEscape(r+""),e);else{if(!g.isRegExp(r))return i;r=new RegExp(r.source,e)}if(r.global)for(;o=r.exec(t);)i.push(o.index+1);else(o=r.exec(t))&&i.push(o.index+1);return i},n.count=function(t,r){return n.find(t,r).length},n.contains=function(t,r){return n.count(t,r)>0},n.between=function(t,r,e){var i,o;return g.allStringOrNumber(t,r,e)?(r=n.regEscape(r+""),e=n.regEscape(e+""),i=new RegExp(r+"(.+)"+e),(null!=(o=i.exec(t+""))?o[1]:void 0)||""):""},n.slice=function(t,r,n){return t=g.forceString(t),r=g.forceNumber(r||1),!1!==(r=g.positiveIndex(r,t.length))?(n=g.forceNumber(n),t.slice(r,r+n)):""},n.truncate=function(t,r,e){return t=g.forceString(t),r=g.forceNumber(r,t.length),t=n.slice(t,1,r),t+g.forceString(e)},n.pop=function(t,r){return t=g.forceString(t),r=g.forceNumber(r,1),t.slice(0,-Math.abs(r))},n.split=function(t,r){var e,i,o,u,s;if(t=n.oneSpaceAndTrim(t),i=[],t.length<1)return i;for(r=g.forceString(r," "),e=t.split(r[0]||""),u=0,s=e.length;s>u;u++)o=e[u],o.match(/^\s$/)||i.push(n.trim(o));return i},n.reverse=function(t){var r,n,e,i;if(null==t&&(t=""),t=g.forceString(t),(n=t.length-1)<1)return t;for(e="",r=i=n;0>=n?0>=i:i>=0;r=0>=n?++i:--i)e+=t[r];return e},n.upper=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],o.apply(null,[r,"toUpperCase"].concat(m.call(t)))},n.lower=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],o.apply(null,[r,"toLowerCase"].concat(m.call(t)))},n.insert=function(){var t,r,n,e,i,o;if(i=arguments[0],r=arguments[1],e=3<=arguments.length?m.call(arguments,2):[],""===(i=g.forceString(i))||""===(r=g.forceString(r)))return i;if(e=g.sortNoDupAndReverse(e,i.length),n=f(e)-1,0>n)return i;for(t=o=0;n>=0?n>=o:o>=n;t=n>=0?++o:--o)t=e[t],t>i.length?i+=r:i=i.substr(0,t)+r+i.substr(t);return i},n.removeRange=function(t,r,e){var i;return t=g.forceString(t),""===t||!1===(r=g.positiveIndex(r,t.length))||0>(e=g.forceNumber(e,1))?t:(i=r+e,n.xs(t,function(t,n){return r>n||n>=i?!0:void 0}))},n.removePos=function(){var t,r,e;return e=arguments[0],r=2<=arguments.length?m.call(arguments,1):[],""===(e=g.forceString(e))?"":(t=r.map(function(t){return g.positiveIndex(t,e.length)}),n.xs(e,function(r,n){return y.call(t,n)>=0?void 0:!0}))},n.remove=function(){var t,r,e,i,o;if(r=arguments[0],e=2<=arguments.length?m.call(arguments,1):[],null==r&&(r=""),""===(r=g.forceString(r))||e.length<1)return r;for(i=0,o=e.length;o>i;i++)t=e[i],r=n.replace(r,t);return r},n.startsWith=function(t,r){return""===(t=g.forceString(t))||""===(r=g.forceString(r))?!1:(r=new RegExp("^"+n.regEscape(r)),r.test(t))},n.endsWith=function(t,r){return""===(t=g.forceString(t))||""===(r=g.forceString(r))?!1:(r=new RegExp(n.regEscape(r)+"$"),r.test(t))},n.wrap=function(t,r){var e;return null==t&&(t=""),null==r&&(r=""),e=function(e){return n.create(t,e,r)},e.wrap=function(n,e){return null==n&&(n=""),null==e&&(e=""),t=g.forceString(n)+t,r+=g.forceString(e)},e},n.prototype.set=function(){return this.string=n.create.apply(this,arguments),this},n.prototype.sort=function(){return this.string=n.sort(this.string),this},n.prototype.random=function(t,r){return this.string=n.random(t,r),this},n.prototype.xs=function(t){return this.string=n.xs(this.string,t),this},n.prototype.times=function(t){return null==t&&(t=1),this.string=n.times(this.string,t),this},n.prototype.get=function(){var t,r,n,e;if(arguments.length>0){for(r="",n=0,e=arguments.length;e>n;n++)t=arguments[n],t=g.positiveIndex(t,this.length),t!==!1&&(r+=this.string[t]);return r}return this.string},n.prototype.copy=function(t,r){return n.copy(this.string,t,r)},n.prototype.empty=function(){return n.empty(this.string)},n.prototype.isAlpha=function(){return n.isAlpha(this.string)},n.prototype.isNumeric=function(){return n.isNumeric(this.string)},n.prototype.isAlphaNumeric=function(){return n.isAlphaNumeric(this.string)},n.prototype.isSpecial=function(){return n.isSpecial(this.string)},n.prototype.isSpace=function(){return n.isSpace(this.string)},n.prototype.push=function(){return this.string=this.string+n.create.apply(this,arguments),this},n.prototype.prepend=function(){return this.string=n.create.apply(this,arguments)+this.string,this},n.prototype.pop=function(t){return this.string=n.pop(this.string,t),this},n.prototype.insert=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],this.string=n.insert.apply(n,[this.string,r].concat(m.call(t))),this},n.prototype.trim=function(){return this.string=n.trim(this.string),this},n.prototype.trimLeft=function(){return this.string=n.trimLeft(this.string),this},n.prototype.trimRight=function(){return this.string=n.trimRight(this.string),this},n.prototype.oneSpace=function(){return this.string=n.oneSpace(this.string),this},n.prototype.oneSpaceAndTrim=function(){return this.string=n.oneSpaceAndTrim(this.string),this},n.prototype.find=function(t){return n.find(this.string,t)},n.prototype.count=function(t){return n.count(this.string,t)},n.prototype.contains=function(t){return n.contains(this.string,t)},n.prototype.between=function(t,r){return n.between(this.string,t,r)},n.prototype.slice=function(t,r){return this.string=n.slice(this.string,t,r),this},n.prototype.truncate=function(t,r){return this.string=n.truncate(this.string,t,r),this},n.prototype.remove=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.remove.apply(n,[this.string].concat(m.call(t))),this},n.prototype.removeRange=function(t,r){return this.string=n.removeRange(this.string,t,r),this},n.prototype.removePos=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.removePos.apply(n,[this.string].concat(m.call(t))),this},n.prototype.replace=function(t,r,e){return this.string=n.replace(this.string,t,r,e),this},n.prototype.reverse=function(){return this.string=n.reverse(this.string),this},n.prototype.upper=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.upper.apply(n,[this.string].concat(m.call(t))),this},n.prototype.lower=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.lower.apply(n,[this.string].concat(m.call(t))),this},n.prototype.shuffle=function(){return this.string=n.shuffle(this.string),this},n.prototype.toCamel=function(t){return this.string=n.toCamel(this.string,t),this},n.prototype.unCamel=function(t){return this.string=n.unCamel(this.string,t),this},n.prototype.startsWith=function(t){return n.startsWith(this.string,t)},n.prototype.endsWith=function(t){return n.endsWith(this.string,t)},n.prototype.setWrap=function(t,r){return g.isNull(this.wrapMethod)?this.wrapMethod=n.wrap(t,r):this.wrapMethod.wrap(t,r),this},n.prototype.removeWrap=function(){return this.wrapMethod=null,this},n.prototype.applyWrap=function(t,r){return this.string=this.setWrap(t,r).wrap,this.removeWrap(),this},n}(t),Object.defineProperty(r.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(r.prototype,"length",{get:function(){return this.string.length}}),Object.defineProperty(r.prototype,"wrap",{get:function(){return g.isNull(this.wrapMethod)?this.string:this.wrapMethod(this.string)}}),r.Types=n,r.Chars=t,r.crop=r.slice,r.prototype.crop=r.prototype.slice,r.prototype.append=r.prototype.push,console.log(new r("!@ #$").isSpecial()),"undefined"!=typeof window&&null!==window?window.Strings=r:module.exports=r}).call(this); | ||
(function(){"use strict";var t,r,n,e,i,o,u,s,c,f,a,p,g,l={}.hasOwnProperty,h=function(t,r){function n(){this.constructor=t}for(var e in r)l.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},m=[].slice,y=[].indexOf||function(t){for(var r=0,n=this.length;n>r;r++)if(r in this&&this[r]===t)return r;return-1};s=function(){var t;return t=new Number,t["void"]=!0,t},n={parseIntBase:10},c={Boolean:!1,String:"",Number:s(),Object:{},Array:[],Function:function(){}},u=function(t){var r;return r=function(r){switch(t){case"Number":if(n.isNumber(r=parseInt(r,n.parseIntBase)))return r;break;case"String":if(n.isStringOrNumber(r))return r+"";break;default:if(n["is"+t](r))return r}return!1},function(n,e){return!1!==(n=r(n))?n:!1!==(e=r(e))?e:c[t]}},a=function(t,r,n){var e,i,o;if(null==n&&(n=[]),n.length<1)return t===p.Undefined?!0:!1;for(i=0,o=n.length;o>i;i++)if(e=n[i],t(e)===r)return r;return!r},p={Undefined:function(t){return void 0===t},Null:function(t){return null===t},Boolean:function(t){return"boolean"==typeof t},String:function(t){return"string"==typeof t},Function:function(t){return"function"==typeof t},Number:function(t){return"number"==typeof t&&t===t||"object"==typeof t&&t instanceof Number&&t["void"]},Array:function(t){return"object"==typeof t&&t instanceof Array},RegExp:function(t){return"object"==typeof t&&t instanceof RegExp},Date:function(t){return"object"==typeof t&&t instanceof Date},Object:function(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof RegExp||t instanceof Date)},NaN:function(t){return"number"==typeof t&&t!==t},Defined:function(t){return void 0!==t}},p.StringOrNumber=function(t){return p.String(t)||p.Number(t)},i=!0,function(){var t,r,e;e=[];for(t in p)r=p[t],e.push(function(t,r){return n["is"+t]=r,n["not"+t]=function(t){return!r(t)},n["has"+t]=function(){return a(r,i,arguments)},n["all"+t]=function(){return a(r,!i,arguments)},t in c?n["force"+t]=u(t):void 0}(t,r));return e}(),n["typeof"]=function(t){var r,n;for(n in p)if(r=p[n],r(t)===!0)return n.toLowerCase();return"unknown"},f=function(t){var r,n,e,i,o;if(g.notArray(t))return 0;for(r=i=0,o=t.length;o>i;r=++i){if(e=t[r],n=g.forceNumber(e),n["void"])return r;t[r]=n}return t.length},g=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return h(r,t),r.inRange=function(t,n){return r.isNaN(t=parseInt(t,10))||f(n)<2?!1:t>=n[0]&&t<=n[1]},r.limitNumber=function(t,n){return t=r.forceNumber(t,0),f(n)<2?t:t<n[0]?n[0]:t>n[1]?n[1]:t},r.randomNumber=function(t,r){return f([t,r])<2?0:t>r?t:(r=r-t+1,Math.floor(Math.random()*r+t))},r.shuffleArray=function(t){var n,e,i,o,u;if(r.notArray(t)||t.length<1)return[];for(e=t.length-1,n=u=e;0>=e?0>=u:u>=0;n=0>=e?++u:--u)i=r.randomNumber(0,n),o=t[n],t[n]=t[i],t[i]=o;return t},r.positiveIndex=function(t,n){return 0===(t=r.forceNumber(t,0))?!1:(n=Math.abs(r.forceNumber(n)),Math.abs(t)<=n?t>0?t-1:n+t:!1)},r.insertSort=function(t){var r,n,e,i,o;for(e=t.length-1,n=o=1;e>=1?e>=o:o>=e;n=e>=1?++o:--o){for(r=t[n],i=n-1;i>=0&&t[i]>r;)t[i+1]=t[i],--i;t[+i+1]=r}return t},r.noDupAndReverse=function(t){var r,n,e,i;for(n=t.length-1,e=[],r=i=n;0>=n?0>=i:i>=0;r=0>=n?++i:--i)e[e.length-1]!==t[r]&&e.push(t[r]);return e},r.sortNoDupAndReverse=function(t,n){var e,i,o,u,s;for(i=[],e=u=0,s=t.length;s>u;e=++u)o=t[e],o=r.forceNumber(o),o["void"]||(n>=o&&(o=r.positiveIndex(o,n)),i.push(r.forceNumber(o,0)));return r.noDupAndReverse(r.insertSort(i))},r}(n),t=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return h(r,t),r.ASCII_RANGE_UPPERCASE=[65,90],r.ASCII_RANGE_LOWERCASE=[97,122],r.ASCII_RANGE_NUMBERS=[48,57],r.ASCII_RANGE_SPECIAL_1=[32,47],r.ASCII_RANGE_SPECIAL_2=[58,64],r.ASCII_RANGE_SPECIAL_3=[91,96],r.ASCII_RANGE_SPECIAL_4=[123,126],r.ASCII_RANGE_ALL=[32,126],r.REGEXP_SPECIAL_CHARS=["?","\\","[","]","(",")","*","+",".","/","|","^","$","<",">","-","&"],r.ascii=function(t){return String.fromCharCode(g.forceNumber(t))},r.ordinal=function(t){return g.forceNumber(g.forceString(t).charCodeAt(),0)},r.random=function(t){var n,e;return t=g.forceArray(t,r.ASCII_RANGE_ALL),e=g.limitNumber(t[0],t),n=g.limitNumber(t[1],t),r.ascii(g.randomNumber(e,n))},r}(g),o=function(){var t,n,e,i,o,u,s,c,f;if(o=arguments[0],e=arguments[1],n=3<=arguments.length?m.call(arguments,2):[],null==o&&(o=""),""===(o=g.forceString(o)))return o;if(n.length<1||void 0===n[0])return o[e]();if(g.isNumber(n[0]))for(u=0,c=n.length;c>u;u++)t=n[u],i=g.positiveIndex(t,o.length),o=r.xs(o,function(t,r){return r===i?t[e]():t});else if(g.isString(n[0]))for(s=0,f=n.length;f>s;s++)t=n[s],o=r.replace(o,t,t[e](),"gi");return o},e=function(t,r){var n,e,i;if(""===(t=g.forceString(t)))return!1;for(e=0,i=t.length;i>e;e++)if(n=t[e],!r(n))return!1;return!0},r=function(r){function n(){this.set.apply(this,arguments),this.wrapMethod=null,this.crop=this.slice}return h(n,r),n.create=function(){var t,r,n,e;for(r="",n=0,e=arguments.length;e>n;n++)t=arguments[n],r+=g.forceString(t);return r},n.get=function(){var t,r,n,e,i,o,u;if(o=arguments[0],e=2<=arguments.length?m.call(arguments,1):[],arguments.length<2)return"";for(o=g.forceString(o),r=o.length,i="",t=arguments.length,n=u=1;t>=1?t>=u:u>=t;n=t>=1?++u:--u)n=g.positiveIndex(arguments[n],r),n!==!1&&(i+=o[n]);return i},n.sort=function(t){return t=g.forceString(t).trim().split(""),g.insertSort(t).join("")},n.random=function(r,n){var e,i,o;for(r=g.forceNumber(r,1),i="",e=o=1;r>=1?r>=o:o>=r;e=r>=1?++o:--o)i+=t.random(n);return i},n.times=function(t,r){var n;if(""===(t=g.forceString(t)))return"";for(r=g.forceNumber(r,1),n="";r-->0;)n+=t;return n},n.regEscape=function(r){return""===(r=g.forceString(r))?r:n.xs(r,function(r){return y.call(t.REGEXP_SPECIAL_CHARS,r)>=0?"\\"+r:!0})},n.empty=function(t){return g.notString(t)||t.length>0?!1:!0},n.isAlpha=function(t){return""===(t=g.forceString(t))?!1:/^[a-z]*$/gi.test(t)},n.isNumeric=function(t){return""===(t=g.forceString(t))?!1:/^[0-9]*$/g.test(t)},n.isAlphaNumeric=function(t){return""===(t=g.forceString(t))?!1:/^[0-9|a-z]*$/gi.test(t)},n.isSpecial=function(t){return""===(t=g.forceString(t))?!1:/^[^0-9|a-z]*$/gi.test(t)},n.isSpace=function(t){return/^[ \t]+$/g.test(t)},n.xs=function(t,r){var n,e,i,o,u;if(null==t&&(t=""),t=g.forceString(t),-1===(e=t.length-1))return"";for(r=g.forceFunction(r,function(t){return t}),o="",n=u=0;e>=0?e>=u:u>=e;n=e>=0?++u:--u)(i=r(t[n],n))&&(i===!0?o+=t[n]:g.isStringOrNumber(i)&&(o+=i));return o},n.copy=function(t,r,n){return r=g.forceNumber(r),""===(t=g.forceString(t))||Math.abs(r)>t.length?"":(r>0&&(r-=1),t.substr(r,g.forceNumber(n,t.length)))},n.replace=function(t,r,e,i){var o;return null==t&&(t=""),null==r&&(r=""),null==e&&(e=""),null==i&&(i="g"),!g.isStringOrNumber(t)||"string"!==(o=g["typeof"](r))&&"number"!==o&&"regexp"!==o?g.forceString(t):(g.notRegExp(r)&&(r=n.regEscape(r+""),r=new RegExp(r,i)),(t+"").replace(r,e))},n.trim=function(t){return n.replace(t,/^\s+|\s+$/g)},n.trimLeft=function(t){return n.replace(t,/^\s+/g)},n.trimRight=function(t){return n.replace(t,/\s+$/g)},n.oneSpace=function(t){return n.replace(t,/\s+/g," ")},n.oneSpaceAndTrim=function(t){return n.oneSpace(n.trim(t))},n.toCamel=function(t,r){var e;return t=g.forceString(t),r=g.forceString(r,"-"),e=new RegExp(n.regEscape(r)+"([a-z])","ig"),n.replace(t,e,function(t,r){return r.toUpperCase()})},n.unCamel=function(t,r){return t=g.forceString(t),r=g.forceString(r,"-"),n.replace(t,/([A-Z])/g,r+"$1").toLowerCase()},n.shuffle=function(t){return t=g.forceString(t),g.shuffleArray((t+"").split("")).join("")},n.find=function(t,r,e){var i,o;if(i=[],""===(t=g.forceString(t)))return i;if(e=g.forceString(e,"g"),g.isStringOrNumber(r))r=new RegExp(n.regEscape(r+""),e);else{if(!g.isRegExp(r))return i;r=new RegExp(r.source,e)}if(r.global)for(;o=r.exec(t);)i.push(o.index+1);else(o=r.exec(t))&&i.push(o.index+1);return i},n.count=function(t,r){return n.find(t,r).length},n.contains=function(t,r){return n.count(t,r)>0},n.between=function(t,r,e){var i,o;return g.allStringOrNumber(t,r,e)?(r=n.regEscape(r+""),e=n.regEscape(e+""),i=new RegExp(r+"(.+)"+e),(null!=(o=i.exec(t+""))?o[1]:void 0)||""):""},n.slice=function(t,r,n){return t=g.forceString(t),r=g.forceNumber(r||1),!1!==(r=g.positiveIndex(r,t.length))?(n=g.forceNumber(n),t.slice(r,r+n)):""},n.truncate=function(t,r,e){return t=g.forceString(t),r=g.forceNumber(r,t.length),t=n.slice(t,1,r),t+g.forceString(e)},n.pop=function(t,r){return t=g.forceString(t),r=g.forceNumber(r,1),t.slice(0,-Math.abs(r))},n.split=function(t,r){var e,i,o,u,s;if(t=n.oneSpaceAndTrim(t),i=[],t.length<1)return i;for(r=g.forceString(r," "),e=t.split(r[0]||""),u=0,s=e.length;s>u;u++)o=e[u],o.match(/^\s$/)||i.push(n.trim(o));return i},n.reverse=function(t){var r,n,e,i;if(null==t&&(t=""),t=g.forceString(t),(n=t.length-1)<1)return t;for(e="",r=i=n;0>=n?0>=i:i>=0;r=0>=n?++i:--i)e+=t[r];return e},n.upper=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],o.apply(null,[r,"toUpperCase"].concat(m.call(t)))},n.lower=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],o.apply(null,[r,"toLowerCase"].concat(m.call(t)))},n.insert=function(){var t,r,n,e,i,o;if(i=arguments[0],r=arguments[1],e=3<=arguments.length?m.call(arguments,2):[],""===(i=g.forceString(i))||""===(r=g.forceString(r)))return i;if(e=g.sortNoDupAndReverse(e,i.length),n=f(e)-1,0>n)return i;for(t=o=0;n>=0?n>=o:o>=n;t=n>=0?++o:--o)t=e[t],t>i.length?i+=r:i=i.substr(0,t)+r+i.substr(t);return i},n.removeRange=function(t,r,e){var i;return t=g.forceString(t),""===t||!1===(r=g.positiveIndex(r,t.length))||0>(e=g.forceNumber(e,1))?t:(i=r+e,n.xs(t,function(t,n){return r>n||n>=i?!0:void 0}))},n.removePos=function(){var t,r,e;return e=arguments[0],r=2<=arguments.length?m.call(arguments,1):[],""===(e=g.forceString(e))?"":(t=r.map(function(t){return g.positiveIndex(t,e.length)}),n.xs(e,function(r,n){return y.call(t,n)>=0?void 0:!0}))},n.remove=function(){var t,r,e,i,o;if(r=arguments[0],e=2<=arguments.length?m.call(arguments,1):[],null==r&&(r=""),""===(r=g.forceString(r))||e.length<1)return r;for(i=0,o=e.length;o>i;i++)t=e[i],r=n.replace(r,t);return r},n.startsWith=function(t,r){return""===(t=g.forceString(t))||""===(r=g.forceString(r))?!1:(r=new RegExp("^"+n.regEscape(r)),r.test(t))},n.endsWith=function(t,r){return""===(t=g.forceString(t))||""===(r=g.forceString(r))?!1:(r=new RegExp(n.regEscape(r)+"$"),r.test(t))},n.wrap=function(t,r){var e;return null==t&&(t=""),null==r&&(r=""),e=function(e){return n.create(t,e,r)},e.wrap=function(n,e){return null==n&&(n=""),null==e&&(e=""),t=g.forceString(n)+t,r+=g.forceString(e)},e},n.prototype.set=function(){return this.string=n.create.apply(this,arguments),this},n.prototype.sort=function(){return this.string=n.sort(this.string),this},n.prototype.random=function(t,r){return this.string=n.random(t,r),this},n.prototype.xs=function(t){return this.string=n.xs(this.string,t),this},n.prototype.times=function(t){return null==t&&(t=1),this.string=n.times(this.string,t),this},n.prototype.get=function(){var t,r,n,e;if(arguments.length>0){for(r="",n=0,e=arguments.length;e>n;n++)t=arguments[n],t=g.positiveIndex(t,this.length),t!==!1&&(r+=this.string[t]);return r}return this.string},n.prototype.copy=function(t,r){return n.copy(this.string,t,r)},n.prototype.empty=function(){return n.empty(this.string)},n.prototype.isAlpha=function(){return n.isAlpha(this.string)},n.prototype.isNumeric=function(){return n.isNumeric(this.string)},n.prototype.isAlphaNumeric=function(){return n.isAlphaNumeric(this.string)},n.prototype.isSpecial=function(){return n.isSpecial(this.string)},n.prototype.isSpace=function(){return n.isSpace(this.string)},n.prototype.push=function(){return this.string=this.string+n.create.apply(this,arguments),this},n.prototype.prepend=function(){return this.string=n.create.apply(this,arguments)+this.string,this},n.prototype.pop=function(t){return this.string=n.pop(this.string,t),this},n.prototype.insert=function(){var t,r;return r=arguments[0],t=2<=arguments.length?m.call(arguments,1):[],this.string=n.insert.apply(n,[this.string,r].concat(m.call(t))),this},n.prototype.trim=function(){return this.string=n.trim(this.string),this},n.prototype.trimLeft=function(){return this.string=n.trimLeft(this.string),this},n.prototype.trimRight=function(){return this.string=n.trimRight(this.string),this},n.prototype.oneSpace=function(){return this.string=n.oneSpace(this.string),this},n.prototype.oneSpaceAndTrim=function(){return this.string=n.oneSpaceAndTrim(this.string),this},n.prototype.find=function(t){return n.find(this.string,t)},n.prototype.count=function(t){return n.count(this.string,t)},n.prototype.contains=function(t){return n.contains(this.string,t)},n.prototype.between=function(t,r){return n.between(this.string,t,r)},n.prototype.slice=function(t,r){return this.string=n.slice(this.string,t,r),this},n.prototype.truncate=function(t,r){return this.string=n.truncate(this.string,t,r),this},n.prototype.remove=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.remove.apply(n,[this.string].concat(m.call(t))),this},n.prototype.removeRange=function(t,r){return this.string=n.removeRange(this.string,t,r),this},n.prototype.removePos=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.removePos.apply(n,[this.string].concat(m.call(t))),this},n.prototype.replace=function(t,r,e){return this.string=n.replace(this.string,t,r,e),this},n.prototype.reverse=function(){return this.string=n.reverse(this.string),this},n.prototype.upper=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.upper.apply(n,[this.string].concat(m.call(t))),this},n.prototype.lower=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],this.string=n.lower.apply(n,[this.string].concat(m.call(t))),this},n.prototype.shuffle=function(){return this.string=n.shuffle(this.string),this},n.prototype.toCamel=function(t){return this.string=n.toCamel(this.string,t),this},n.prototype.unCamel=function(t){return this.string=n.unCamel(this.string,t),this},n.prototype.startsWith=function(t){return n.startsWith(this.string,t)},n.prototype.endsWith=function(t){return n.endsWith(this.string,t)},n.prototype.setWrap=function(t,r){return g.isNull(this.wrapMethod)?this.wrapMethod=n.wrap(t,r):this.wrapMethod.wrap(t,r),this},n.prototype.removeWrap=function(){return this.wrapMethod=null,this},n.prototype.applyWrap=function(t,r){return this.string=this.setWrap(t,r).wrap,this.removeWrap(),this},n}(t),Object.defineProperty(r.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(r.prototype,"length",{get:function(){return this.string.length}}),Object.defineProperty(r.prototype,"wrap",{get:function(){return g.isNull(this.wrapMethod)?this.string:this.wrapMethod(this.string)}}),r.Types=n,r.Chars=t,r.crop=r.slice,r.prototype.crop=r.prototype.slice,r.prototype.append=r.prototype.push,"undefined"!=typeof window&&null!==window?window.Strings=r:module.exports=r}).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
209360
2492
889