Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strings.js

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strings.js - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "strings.js",
"version": "1.1.0",
"version": "1.1.1",
"description": "A flexible, robust and powerful Javascript string manipulation library.",

@@ -5,0 +5,0 @@ "main": "strings.min.js",

@@ -46,3 +46,3 @@ strings.js

s.remove('Hello', 'library', ' '); // Strings!
s.shift('reversed ').reverse(); // !sgnirtS desrever
s.prepend('reversed ').reverse(); // !sgnirtS desrever
s.shuffle(); // getriever!nrss dS (random on every run)

@@ -52,3 +52,3 @@ s.set(); // (.set with no usable argument wipes the string)

// let's get a little more funky:
s.set('scgbnaicrbtas').shift('!').upper(-1)
s.set('scgbnaicrbtas').prepend('!').upper(-1)
.remove('a', 'b', 'c').reverse(); // Strings!

@@ -182,4 +182,4 @@ s.setWrap( '<3 ' ).wrap; // <3 Strings! (.wrap only returns the wrapped string, this.string is still <3)

**Strings.prototype.shift**
> `<this> shift ( <string>/<number> string, [string1, ..., stringN] )`
**Strings.prototype.prepend**
> `<this> prepend ( <string>/<number> string, [string1, ..., stringN] )`

@@ -186,0 +186,0 @@ > Prepend this.string with string(s).

@@ -830,3 +830,3 @@ // Generated by CoffeeScript 1.8.0

Strings.prototype.shift = function() {
Strings.prototype.prepend = function() {
this.string = Strings.create.apply(this, arguments) + this.string;

@@ -833,0 +833,0 @@ return this;

@@ -1,1 +0,1 @@

(function(){"use strict";var t,r,n,e,i,u,o,s,f,c={}.hasOwnProperty,a=function(t,r){for(var n in r){if(c.call(r,n))t[n]=r[n]}function e(){this.constructor=t}e.prototype=r.prototype;t.prototype=new e;t.__super__=r.prototype;return t},p=[].slice,l=[].indexOf||function(t){for(var r=0,n=this.length;r<n;r++){if(r in this&&this[r]===t)return r}return-1};e={};(function(){var t,r,n;r=function(t,r,n){var e,i,u;if(n==null){n=[]}if(n.length<1){return false}for(i=0,u=n.length;i<u;i++){e=n[i];if(t(e)===r){return r}}return!r};n={Undefined:function(t){return t===void 0},Null:function(t){return t===null},Boolean:function(t){return typeof t==="boolean"},String:function(t){return typeof t==="string"},Function:function(t){return typeof t==="function"},Number:function(t){return typeof t==="number"&&t===t},Array:function(t){return typeof t==="object"&&t instanceof Array},RegExp:function(t){return t instanceof RegExp},Date:function(t){return t instanceof Date},Object:function(t){return typeof t==="object"&&!(t instanceof Array)&&!(t instanceof RegExp)&&!(t===null)},NaN:function(t){return typeof t==="number"&&t!==t}};n.StringOrNumber=function(t){return n["String"](t)||n["Number"](t)};t=true;(function(){var i,u,o;o=[];for(i in n){u=n[i];o.push(function(n,i){e["is"+n]=i;e["not"+n]=function(t){return!i(t)};e["has"+n]=function(){return r(i,t,arguments)};return e["all"+n]=function(){return r(i,!t,arguments)}}(i,u))}return o})();return e["typeof"]=function(t){var r,e;for(e in n){r=n[e];if(r(t)===true){return e.toLowerCase()}}return"unknown"}})();r=function(){function t(){}t.force=function(t,r){if(f.notNaN(t=parseInt(t,10))){return t}if(f.notNaN(r=parseInt(r,10))){return r}return 0};return t}();s=function(t){var r,n,e,i,u;if(f.notArray(t)){return 0}for(r=i=0,u=t.length;i<u;r=++i){e=t[r];if(f.isNaN(n=parseInt(t[r],10))){return r}t[r]=n}return t.length};f=function(t){a(n,t);function n(){return n.__super__.constructor.apply(this,arguments)}n.inRange=function(t,r){if(n.isNaN(t=parseInt(t,10))||s(r)<2){return false}return t>=r[0]&&t<=r[1]};n.limitNumber=function(t,r){if(s(r)<2){return 0}if(n.isNaN(t=parseInt(t,10))||t<r[0]){return r[0]}if(t>r[1]){return r[1]}return t};n.randomNumber=function(t,r){if(s([t,r])<2){return 0}if(r<t){return t}r=r-t+1;return Math.floor(Math.random()*r+t)};n.shuffleArray=function(t){var r,e,i,u,o;if(n.notArray(t)||t.length<1){return[]}e=t.length-1;for(r=o=e;e<=0?o<=0:o>=0;r=e<=0?++o:--o){i=n.randomNumber(0,r);u=t[r];t[r]=t[i];t[i]=u}return t};n.positiveIndex=function(t,n){if(0===(t=r.force(t))){return false}n=r.force(n);if(Math.abs(t)<=n){if(t>0){return t-1}return n+t}return false};return n}(e);o=function(t,r){if(f.isStringOrNumber(t)){return t+""}if(f.isStringOrNumber(r)){return r+""}return""};t=function(t){a(n,t);function n(){return n.__super__.constructor.apply(this,arguments)}n.ASCII_RANGE_UPPERCASE=[65,90];n.ASCII_RANGE_LOWERCASE=[97,122];n.ASCII_RANGE_NUMBERS=[48,57];n.ASCII_RANGE_ALL=[32,126];n.REGEXP_SPECIAL_CHARS=["?","\\","[","]","(",")","*","+",".","/","|","^","$","<",">","-","&"];n.ascii=function(t){return String.fromCharCode(r.force(t))};n.ordinal=function(t){return r.force(o(t).charCodeAt())};n.isUpper=function(t){return f.inRange(n.ordinal(t),n.ASCII_RANGE_UPPERCASE)};n.isLower=function(t){return f.inRange(n.ordinal(t),n.ASCII_RANGE_LOWERCASE)};n.isAlpha=function(t){return n.isUpper(t)||n.isLower(t)};n.isNumeric=function(t){return f.inRange(n.ordinal(t),n.ASCII_RANGE_NUMBERS)};n.isSpecial=function(t){return!(n.isAlphaNumeric(t)||t===" ")};n.isAlphaNumeric=function(t){return n.isAlpha(t)||n.isNumeric(t)};n.random=function(t){var r,e;if(t==null){t=n.ASCII_RANGE_ALL}if(f.notArray(t)||t.length<2){return""}e=f.limitNumber(t[0],t);r=f.limitNumber(t[1],t);return n.ascii(f.randomNumber(e,r))};return n}(f);u=function(){var t,r,e,i,u,o,s,c,a;u=arguments[0],e=arguments[1],r=3<=arguments.length?p.call(arguments,2):[];if(u==null){u=""}if(f.notString(u)){return u}if(r.length<1){return u[e]()}else if(f.isNumber(r[0])){for(o=0,c=r.length;o<c;o++){t=r[o];i=f.positiveIndex(t,u.length);u=n.xs(u,function(t,r){if(r===i){return t[e]()}return t})}}else if(f.isString(r[0])){for(s=0,a=r.length;s<a;s++){t=r[s];u=n.replace(u,t,t[e](),"gi")}}return u};i=function(t,r){var e,i,u;if(""===(t=n.force(t))){return false}for(i=0,u=t.length;i<u;i++){e=t[i];if(!r(e)){return false}}return true};n=function(n){a(e,n);e.force=function(t,r){return o(t,r)};e.create=function(){var t,r,n,e;r="";for(n=0,e=arguments.length;n<e;n++){t=arguments[n];if(f.isStringOrNumber(t)){r+=t}}return r};e.random=function(n,e){var i,u,o;n=r.force(n,1);u="";for(i=o=1;1<=n?o<=n:o>=n;i=1<=n?++o:--o){u+=t.random(e)}return u};e.times=function(t,n){var i;if(""===e.force(t)){return""}n=r.force(n,1);i="";while(n-->0){i+=t}return i};e.regEscape=function(r){if(""===(r=e.force(r))){return r}return e.xs(r,function(r){if(l.call(t.REGEXP_SPECIAL_CHARS,r)>=0){return"\\"+r}return true})};e.empty=function(t){if(f.notString(t)||t.length>0){return false}return true};e.isAlpha=function(r){return i(r,t.isAlpha)};e.isNumeric=function(r){return i(r,t.isNumeric)};e.isAlphaNumeric=function(r){return i(r,t.isAlphaNumeric)};e.isSpecial=function(r){return i(r,t.isSpecial)};e.isSpace=function(t){return/^[ \t]+$/g.test(t)};e.xs=function(t,r){var n,e,i,u,o;if(t==null){t=""}if(r==null){r=function(t){return t}}if(f.notString(t)||f.notFunction(r)){return""}u="";if((e=t.length-1)<0){return u}for(n=o=0;0<=e?o<=e:o>=e;n=0<=e?++o:--o){if(i=r(t[n],n)){if(i===true){u+=t[n]}else if(f.isStringOrNumber(i)){u+=i}}}return u};e.copy=function(t,n,i){if(""===(t=e.force(t))){return""}if(n==null){return t}n=r.force(n);if(Math.abs(n)>t.length){return""}if(n>0){--n}return t.substr(n,r.force(i,1))};e.replace=function(t,r,n,i){var u;if(t==null){t=""}if(r==null){r=""}if(n==null){n=""}if(i==null){i="g"}if(!(f.isStringOrNumber(t)&&((u=f.isStringOrNumber(r))||f.isRegExp(r)))){return e.force(t)}if(u){r=e.regEscape(r+"");r=new RegExp(r,i)}return(t+"").replace(r,n)};e.trim=function(t){return e.replace(t,/^\s+|\s+$/g)};e.trimLeft=function(t){return e.replace(t,/^\s+/g)};e.trimRight=function(t){return e.replace(t,/\s+$/g)};e.oneSpace=function(t){return e.replace(t,/([ \t]+)/g," ")};e.oneSpaceAndTrim=function(t){return e.oneSpace(e.trim(t))};e.toCamel=function(t,r){var n;if(r==null){r="-"}t=e.force(t);r=e.force(r);n=new RegExp(e.regEscape(r)+"([a-z])","ig");return e.replace(t,n,function(t,r){return r.toUpperCase()})};e.unCamel=function(t,r){if(r==null){r="-"}t=e.force(t);r=e.force(r);return e.replace(t,/([A-Z])/g,r+"$1").toLowerCase()};e.shuffle=function(t){t=e.force(t);return f.shuffleArray((t+"").split("")).join("")};e.find=function(t,r){var n,i;n=[];if(""===(t=e.force(t))){return n}if(f.isStringOrNumber(r)){r=new RegExp(e.regEscape(r+""),"g")}else if(f.isRegExp(r)){r=new RegExp(r.source,"g")}else{return n}while(i=r.exec(t)){n.push(i.index+1)}return n};e.count=function(t,r){return e.find(t,r).length};e.contains=function(t,r){return e.find(t,r).length>0};e.between=function(t,r,n){var i,u;if(!f.allStringOrNumber(t,r,n)){return""}r=e.regEscape(r+"");n=e.regEscape(n+"");i=new RegExp(r+"(.+)"+n);return((u=i.exec(t+""))!=null?u[1]:void 0)||""};e.slice=function(t,n,i){t=e.force(t);n=r.force(n);if(false!==(n=f.positiveIndex(n,t.length))){i=r.force(i);return t.slice(n,n+i)}return""};e.truncate=function(t,n,i){t=e.force(t);n=r.force(n,t.length);t=e.slice(t,1,n);return t+e.force(i)};e.pop=function(t,n){t=e.force(t);n=r.force(n,1);return t.slice(0,-Math.abs(n))};e.split=function(t,r){var n,i,u,o,s;t=e.oneSpaceAndTrim(t);r=e.force(r," ");u=[];n=t.split(r);for(o=0,s=n.length;o<s;o++){i=n[o];if(i===""){continue}u.push(i)}return u};e.reverse=function(t){var r,n,i,u;if(t==null){t=""}t=e.force(t);if((n=t.length-1)<1){return t}i="";for(r=u=n;n<=0?u<=0:u>=0;r=n<=0?++u:--u){i+=t[r]}return i};e.upper=function(){var t,r;r=arguments[0],t=2<=arguments.length?p.call(arguments,1):[];return u.apply(null,[r,"toUpperCase"].concat(p.call(t)))};e.lower=function(){var t,r;r=arguments[0],t=2<=arguments.length?p.call(arguments,1):[];return u.apply(null,[r,"toLowerCase"].concat(p.call(t)))};e.insert=function(t,r,n){if(n==null){n=1}t=e.force(t);r=e.force(r);if(false===(n=f.positiveIndex(n,t.length))){return t}return t.substr(0,n)+r+t.substr(n)};e.removeRange=function(t,n,i){var u;if(""===(t=e.force(t))){return t}if(false===(n=f.positiveIndex(n,t.length))){return t}i=r.force(i,1);if(i<0){u=n+f.positiveIndex(i,t.length-n)}else{u=n+i}return e.xs(t,function(t,r){if(r<n||r>=u){return true}})};e.removePos=function(){var t,r,n;n=arguments[0],r=2<=arguments.length?p.call(arguments,1):[];if(""===(n=e.force(n))){return""}t=r.map(function(t,r){return f.positiveIndex(t,n.length)});return e.xs(n,function(r,n){if(!(l.call(t,n)>=0)){return true}})};e.remove=function(){var t,r,n,i,u;r=arguments[0],n=2<=arguments.length?p.call(arguments,1):[];if(r==null){r=""}if(""===(r=e.force(r))||n.length<1){return r}for(i=0,u=n.length;i<u;i++){t=n[i];r=e.replace(r,t)}return r};e.startsWith=function(t,r){return e.find(t,r)[0]===1};e.endsWith=function(t,r){if(""===(t=e.force(t))||""===(r=e.force(r))){return false}r=new RegExp(e.regEscape(r)+"$");return r.test(t)};e.wrap=function(t,r){var n;if(t==null){t=""}if(r==null){r=""}n=function(n){return e.create(t,n,r)};n.wrap=function(n,i){if(n==null){n=""}if(i==null){i=""}t=e.force(n)+t;return r+=e.force(i)};return n};function e(){this.set.apply(this,arguments);Object.defineProperty(this,"$",{get:function(){return this.get()}});Object.defineProperty(this,"length",{get:function(){return this.string.length}});Object.defineProperty(this,"wrap",{get:function(){if(!f.isNull(this.wrapMethod)){return this.wrapMethod(this.string)}return this.string}});this.wrapMethod=null;this.crop=this.slice}e.prototype.set=function(){this.string=e.create.apply(this,arguments);return this};e.prototype.random=function(t,r){this.string=e.random(t,r);return this};e.prototype.xs=function(t){this.string=e.xs(this.string,t);return this};e.prototype.times=function(t){if(t==null){t=1}this.string=e.times(this.string,t);return this};e.prototype.get=function(){var t,r,n,e;if(arguments.length>0){r="";for(n=0,e=arguments.length;n<e;n++){t=arguments[n];t=f.positiveIndex(t,this.length);if(t!==false){r+=this.string[t]}}return r}return this.string};e.prototype.copy=function(t,r){return e.copy(this.string,t,r)};e.prototype.empty=function(){return e.empty(this.string)};e.prototype.isAlpha=function(){return e.isAlpha(this.string)};e.prototype.isNumeric=function(){return e.isNumeric(this.string)};e.prototype.isAlphaNumeric=function(){return e.isAlphaNumeric(this.string)};e.prototype.isSpecial=function(){return e.isSpecial(this.string)};e.prototype.isSpace=function(){return e.isSpace(this.string)};e.prototype.push=function(){this.string=this.string+e.create.apply(this,arguments);return this};e.prototype.pop=function(t){this.string=e.pop(this.string,t);return this};e.prototype.shift=function(){this.string=e.create.apply(this,arguments)+this.string;return this};e.prototype.insert=function(t,r){this.string=e.insert(this.string,t,r);return this};e.prototype.trim=function(){this.string=e.trim(this.string);return this};e.prototype.trimLeft=function(){this.string=e.trimLeft(this.string);return this};e.prototype.trimRight=function(){this.string=e.trimRight(this.string);return this};e.prototype.oneSpace=function(){this.string=e.oneSpace(this.string);return this};e.prototype.oneSpaceAndTrim=function(){this.string=e.oneSpaceAndTrim(this.string);return this};e.prototype.find=function(t){return e.find(this.string,t)};e.prototype.count=function(t){return e.count(this.string,t)};e.prototype.contains=function(t){return e.contains(this.string,t)};e.prototype.between=function(t,r){return e.between(this.string,t,r)};e.prototype.slice=function(t,r){this.string=e.slice(this.string,t,r);return this};e.prototype.truncate=function(t,r){this.string=e.truncate(this.string,t,r);return this};e.prototype.remove=function(){var t;t=1<=arguments.length?p.call(arguments,0):[];this.string=e.remove.apply(e,[this.string].concat(p.call(t)));return this};e.prototype.removeRange=function(t,r){this.string=e.removeRange(this.string,t,r);return this};e.prototype.removePos=function(){var t;t=1<=arguments.length?p.call(arguments,0):[];this.string=e.removePos.apply(e,[this.string].concat(p.call(t)));return this};e.prototype.replace=function(t,r,n){this.string=e.replace(this.string,t,r,n);return this};e.prototype.reverse=function(){this.string=e.reverse(this.string);return this};e.prototype.upper=function(){var t;t=1<=arguments.length?p.call(arguments,0):[];this.string=e.upper.apply(e,[this.string].concat(p.call(t)));return this};e.prototype.lower=function(){var t;t=1<=arguments.length?p.call(arguments,0):[];this.string=e.lower.apply(e,[this.string].concat(p.call(t)));return this};e.prototype.shuffle=function(){this.string=e.shuffle(this.string);return this};e.prototype.toCamel=function(t){this.string=e.toCamel(this.string,t);return this};e.prototype.unCamel=function(t){this.string=e.unCamel(this.string,t);return this};e.prototype.startsWith=function(t){return e.startsWith(this.string,t)};e.prototype.endsWith=function(t){return e.endsWith(this.string,t)};e.prototype.setWrap=function(t,r){if(f.isNull(this.wrapMethod)){this.wrapMethod=e.wrap(t,r)}else{this.wrapMethod.wrap(t,r)}return this};e.prototype.removeWrap=function(){this.wrapMethod=null;return this};e.prototype.applyWrap=function(t,r){this.string=this.setWrap(t,r).wrap;this.removeWrap();return this};return e}(t);n.crop=n.slice;if(typeof window!=="undefined"&&window!==null){window.Strings=n}else{module.exports=n}}).call(this);
(function(){"use strict";var t,r,n,e,i,u,o,s,f,c={}.hasOwnProperty,a=function(t,r){for(var n in r){if(c.call(r,n))t[n]=r[n]}function e(){this.constructor=t}e.prototype=r.prototype;t.prototype=new e;t.__super__=r.prototype;return t},p=[].slice,l=[].indexOf||function(t){for(var r=0,n=this.length;r<n;r++){if(r in this&&this[r]===t)return r}return-1};e={};(function(){var t,r,n;r=function(t,r,n){var e,i,u;if(n==null){n=[]}if(n.length<1){return false}for(i=0,u=n.length;i<u;i++){e=n[i];if(t(e)===r){return r}}return!r};n={Undefined:function(t){return t===void 0},Null:function(t){return t===null},Boolean:function(t){return typeof t==="boolean"},String:function(t){return typeof t==="string"},Function:function(t){return typeof t==="function"},Number:function(t){return typeof t==="number"&&t===t},Array:function(t){return typeof t==="object"&&t instanceof Array},RegExp:function(t){return t instanceof RegExp},Date:function(t){return t instanceof Date},Object:function(t){return typeof t==="object"&&!(t instanceof Array)&&!(t instanceof RegExp)&&!(t===null)},NaN:function(t){return typeof t==="number"&&t!==t}};n.StringOrNumber=function(t){return n["String"](t)||n["Number"](t)};t=true;(function(){var i,u,o;o=[];for(i in n){u=n[i];o.push(function(n,i){e["is"+n]=i;e["not"+n]=function(t){return!i(t)};e["has"+n]=function(){return r(i,t,arguments)};return e["all"+n]=function(){return r(i,!t,arguments)}}(i,u))}return o})();return e["typeof"]=function(t){var r,e;for(e in n){r=n[e];if(r(t)===true){return e.toLowerCase()}}return"unknown"}})();r=function(){function t(){}t.force=function(t,r){if(f.notNaN(t=parseInt(t,10))){return t}if(f.notNaN(r=parseInt(r,10))){return r}return 0};return t}();s=function(t){var r,n,e,i,u;if(f.notArray(t)){return 0}for(r=i=0,u=t.length;i<u;r=++i){e=t[r];if(f.isNaN(n=parseInt(t[r],10))){return r}t[r]=n}return t.length};f=function(t){a(n,t);function n(){return n.__super__.constructor.apply(this,arguments)}n.inRange=function(t,r){if(n.isNaN(t=parseInt(t,10))||s(r)<2){return false}return t>=r[0]&&t<=r[1]};n.limitNumber=function(t,r){if(s(r)<2){return 0}if(n.isNaN(t=parseInt(t,10))||t<r[0]){return r[0]}if(t>r[1]){return r[1]}return t};n.randomNumber=function(t,r){if(s([t,r])<2){return 0}if(r<t){return t}r=r-t+1;return Math.floor(Math.random()*r+t)};n.shuffleArray=function(t){var r,e,i,u,o;if(n.notArray(t)||t.length<1){return[]}e=t.length-1;for(r=o=e;e<=0?o<=0:o>=0;r=e<=0?++o:--o){i=n.randomNumber(0,r);u=t[r];t[r]=t[i];t[i]=u}return t};n.positiveIndex=function(t,n){if(0===(t=r.force(t))){return false}n=r.force(n);if(Math.abs(t)<=n){if(t>0){return t-1}return n+t}return false};return n}(e);o=function(t,r){if(f.isStringOrNumber(t)){return t+""}if(f.isStringOrNumber(r)){return r+""}return""};t=function(t){a(n,t);function n(){return n.__super__.constructor.apply(this,arguments)}n.ASCII_RANGE_UPPERCASE=[65,90];n.ASCII_RANGE_LOWERCASE=[97,122];n.ASCII_RANGE_NUMBERS=[48,57];n.ASCII_RANGE_ALL=[32,126];n.REGEXP_SPECIAL_CHARS=["?","\\","[","]","(",")","*","+",".","/","|","^","$","<",">","-","&"];n.ascii=function(t){return String.fromCharCode(r.force(t))};n.ordinal=function(t){return r.force(o(t).charCodeAt())};n.isUpper=function(t){return f.inRange(n.ordinal(t),n.ASCII_RANGE_UPPERCASE)};n.isLower=function(t){return f.inRange(n.ordinal(t),n.ASCII_RANGE_LOWERCASE)};n.isAlpha=function(t){return n.isUpper(t)||n.isLower(t)};n.isNumeric=function(t){return f.inRange(n.ordinal(t),n.ASCII_RANGE_NUMBERS)};n.isSpecial=function(t){return!(n.isAlphaNumeric(t)||t===" ")};n.isAlphaNumeric=function(t){return n.isAlpha(t)||n.isNumeric(t)};n.random=function(t){var r,e;if(t==null){t=n.ASCII_RANGE_ALL}if(f.notArray(t)||t.length<2){return""}e=f.limitNumber(t[0],t);r=f.limitNumber(t[1],t);return n.ascii(f.randomNumber(e,r))};return n}(f);u=function(){var t,r,e,i,u,o,s,c,a;u=arguments[0],e=arguments[1],r=3<=arguments.length?p.call(arguments,2):[];if(u==null){u=""}if(f.notString(u)){return u}if(r.length<1){return u[e]()}else if(f.isNumber(r[0])){for(o=0,c=r.length;o<c;o++){t=r[o];i=f.positiveIndex(t,u.length);u=n.xs(u,function(t,r){if(r===i){return t[e]()}return t})}}else if(f.isString(r[0])){for(s=0,a=r.length;s<a;s++){t=r[s];u=n.replace(u,t,t[e](),"gi")}}return u};i=function(t,r){var e,i,u;if(""===(t=n.force(t))){return false}for(i=0,u=t.length;i<u;i++){e=t[i];if(!r(e)){return false}}return true};n=function(n){a(e,n);e.force=function(t,r){return o(t,r)};e.create=function(){var t,r,n,e;r="";for(n=0,e=arguments.length;n<e;n++){t=arguments[n];if(f.isStringOrNumber(t)){r+=t}}return r};e.random=function(n,e){var i,u,o;n=r.force(n,1);u="";for(i=o=1;1<=n?o<=n:o>=n;i=1<=n?++o:--o){u+=t.random(e)}return u};e.times=function(t,n){var i;if(""===e.force(t)){return""}n=r.force(n,1);i="";while(n-->0){i+=t}return i};e.regEscape=function(r){if(""===(r=e.force(r))){return r}return e.xs(r,function(r){if(l.call(t.REGEXP_SPECIAL_CHARS,r)>=0){return"\\"+r}return true})};e.empty=function(t){if(f.notString(t)||t.length>0){return false}return true};e.isAlpha=function(r){return i(r,t.isAlpha)};e.isNumeric=function(r){return i(r,t.isNumeric)};e.isAlphaNumeric=function(r){return i(r,t.isAlphaNumeric)};e.isSpecial=function(r){return i(r,t.isSpecial)};e.isSpace=function(t){return/^[ \t]+$/g.test(t)};e.xs=function(t,r){var n,e,i,u,o;if(t==null){t=""}if(r==null){r=function(t){return t}}if(f.notString(t)||f.notFunction(r)){return""}u="";if((e=t.length-1)<0){return u}for(n=o=0;0<=e?o<=e:o>=e;n=0<=e?++o:--o){if(i=r(t[n],n)){if(i===true){u+=t[n]}else if(f.isStringOrNumber(i)){u+=i}}}return u};e.copy=function(t,n,i){if(""===(t=e.force(t))){return""}if(n==null){return t}n=r.force(n);if(Math.abs(n)>t.length){return""}if(n>0){--n}return t.substr(n,r.force(i,1))};e.replace=function(t,r,n,i){var u;if(t==null){t=""}if(r==null){r=""}if(n==null){n=""}if(i==null){i="g"}if(!(f.isStringOrNumber(t)&&((u=f.isStringOrNumber(r))||f.isRegExp(r)))){return e.force(t)}if(u){r=e.regEscape(r+"");r=new RegExp(r,i)}return(t+"").replace(r,n)};e.trim=function(t){return e.replace(t,/^\s+|\s+$/g)};e.trimLeft=function(t){return e.replace(t,/^\s+/g)};e.trimRight=function(t){return e.replace(t,/\s+$/g)};e.oneSpace=function(t){return e.replace(t,/([ \t]+)/g," ")};e.oneSpaceAndTrim=function(t){return e.oneSpace(e.trim(t))};e.toCamel=function(t,r){var n;if(r==null){r="-"}t=e.force(t);r=e.force(r);n=new RegExp(e.regEscape(r)+"([a-z])","ig");return e.replace(t,n,function(t,r){return r.toUpperCase()})};e.unCamel=function(t,r){if(r==null){r="-"}t=e.force(t);r=e.force(r);return e.replace(t,/([A-Z])/g,r+"$1").toLowerCase()};e.shuffle=function(t){t=e.force(t);return f.shuffleArray((t+"").split("")).join("")};e.find=function(t,r){var n,i;n=[];if(""===(t=e.force(t))){return n}if(f.isStringOrNumber(r)){r=new RegExp(e.regEscape(r+""),"g")}else if(f.isRegExp(r)){r=new RegExp(r.source,"g")}else{return n}while(i=r.exec(t)){n.push(i.index+1)}return n};e.count=function(t,r){return e.find(t,r).length};e.contains=function(t,r){return e.find(t,r).length>0};e.between=function(t,r,n){var i,u;if(!f.allStringOrNumber(t,r,n)){return""}r=e.regEscape(r+"");n=e.regEscape(n+"");i=new RegExp(r+"(.+)"+n);return((u=i.exec(t+""))!=null?u[1]:void 0)||""};e.slice=function(t,n,i){t=e.force(t);n=r.force(n);if(false!==(n=f.positiveIndex(n,t.length))){i=r.force(i);return t.slice(n,n+i)}return""};e.truncate=function(t,n,i){t=e.force(t);n=r.force(n,t.length);t=e.slice(t,1,n);return t+e.force(i)};e.pop=function(t,n){t=e.force(t);n=r.force(n,1);return t.slice(0,-Math.abs(n))};e.split=function(t,r){var n,i,u,o,s;t=e.oneSpaceAndTrim(t);r=e.force(r," ");u=[];n=t.split(r);for(o=0,s=n.length;o<s;o++){i=n[o];if(i===""){continue}u.push(i)}return u};e.reverse=function(t){var r,n,i,u;if(t==null){t=""}t=e.force(t);if((n=t.length-1)<1){return t}i="";for(r=u=n;n<=0?u<=0:u>=0;r=n<=0?++u:--u){i+=t[r]}return i};e.upper=function(){var t,r;r=arguments[0],t=2<=arguments.length?p.call(arguments,1):[];return u.apply(null,[r,"toUpperCase"].concat(p.call(t)))};e.lower=function(){var t,r;r=arguments[0],t=2<=arguments.length?p.call(arguments,1):[];return u.apply(null,[r,"toLowerCase"].concat(p.call(t)))};e.insert=function(t,r,n){if(n==null){n=1}t=e.force(t);r=e.force(r);if(false===(n=f.positiveIndex(n,t.length))){return t}return t.substr(0,n)+r+t.substr(n)};e.removeRange=function(t,n,i){var u;if(""===(t=e.force(t))){return t}if(false===(n=f.positiveIndex(n,t.length))){return t}i=r.force(i,1);if(i<0){u=n+f.positiveIndex(i,t.length-n)}else{u=n+i}return e.xs(t,function(t,r){if(r<n||r>=u){return true}})};e.removePos=function(){var t,r,n;n=arguments[0],r=2<=arguments.length?p.call(arguments,1):[];if(""===(n=e.force(n))){return""}t=r.map(function(t,r){return f.positiveIndex(t,n.length)});return e.xs(n,function(r,n){if(!(l.call(t,n)>=0)){return true}})};e.remove=function(){var t,r,n,i,u;r=arguments[0],n=2<=arguments.length?p.call(arguments,1):[];if(r==null){r=""}if(""===(r=e.force(r))||n.length<1){return r}for(i=0,u=n.length;i<u;i++){t=n[i];r=e.replace(r,t)}return r};e.startsWith=function(t,r){return e.find(t,r)[0]===1};e.endsWith=function(t,r){if(""===(t=e.force(t))||""===(r=e.force(r))){return false}r=new RegExp(e.regEscape(r)+"$");return r.test(t)};e.wrap=function(t,r){var n;if(t==null){t=""}if(r==null){r=""}n=function(n){return e.create(t,n,r)};n.wrap=function(n,i){if(n==null){n=""}if(i==null){i=""}t=e.force(n)+t;return r+=e.force(i)};return n};function e(){this.set.apply(this,arguments);Object.defineProperty(this,"$",{get:function(){return this.get()}});Object.defineProperty(this,"length",{get:function(){return this.string.length}});Object.defineProperty(this,"wrap",{get:function(){if(!f.isNull(this.wrapMethod)){return this.wrapMethod(this.string)}return this.string}});this.wrapMethod=null;this.crop=this.slice}e.prototype.set=function(){this.string=e.create.apply(this,arguments);return this};e.prototype.random=function(t,r){this.string=e.random(t,r);return this};e.prototype.xs=function(t){this.string=e.xs(this.string,t);return this};e.prototype.times=function(t){if(t==null){t=1}this.string=e.times(this.string,t);return this};e.prototype.get=function(){var t,r,n,e;if(arguments.length>0){r="";for(n=0,e=arguments.length;n<e;n++){t=arguments[n];t=f.positiveIndex(t,this.length);if(t!==false){r+=this.string[t]}}return r}return this.string};e.prototype.copy=function(t,r){return e.copy(this.string,t,r)};e.prototype.empty=function(){return e.empty(this.string)};e.prototype.isAlpha=function(){return e.isAlpha(this.string)};e.prototype.isNumeric=function(){return e.isNumeric(this.string)};e.prototype.isAlphaNumeric=function(){return e.isAlphaNumeric(this.string)};e.prototype.isSpecial=function(){return e.isSpecial(this.string)};e.prototype.isSpace=function(){return e.isSpace(this.string)};e.prototype.push=function(){this.string=this.string+e.create.apply(this,arguments);return this};e.prototype.pop=function(t){this.string=e.pop(this.string,t);return this};e.prototype.prepend=function(){this.string=e.create.apply(this,arguments)+this.string;return this};e.prototype.insert=function(t,r){this.string=e.insert(this.string,t,r);return this};e.prototype.trim=function(){this.string=e.trim(this.string);return this};e.prototype.trimLeft=function(){this.string=e.trimLeft(this.string);return this};e.prototype.trimRight=function(){this.string=e.trimRight(this.string);return this};e.prototype.oneSpace=function(){this.string=e.oneSpace(this.string);return this};e.prototype.oneSpaceAndTrim=function(){this.string=e.oneSpaceAndTrim(this.string);return this};e.prototype.find=function(t){return e.find(this.string,t)};e.prototype.count=function(t){return e.count(this.string,t)};e.prototype.contains=function(t){return e.contains(this.string,t)};e.prototype.between=function(t,r){return e.between(this.string,t,r)};e.prototype.slice=function(t,r){this.string=e.slice(this.string,t,r);return this};e.prototype.truncate=function(t,r){this.string=e.truncate(this.string,t,r);return this};e.prototype.remove=function(){var t;t=1<=arguments.length?p.call(arguments,0):[];this.string=e.remove.apply(e,[this.string].concat(p.call(t)));return this};e.prototype.removeRange=function(t,r){this.string=e.removeRange(this.string,t,r);return this};e.prototype.removePos=function(){var t;t=1<=arguments.length?p.call(arguments,0):[];this.string=e.removePos.apply(e,[this.string].concat(p.call(t)));return this};e.prototype.replace=function(t,r,n){this.string=e.replace(this.string,t,r,n);return this};e.prototype.reverse=function(){this.string=e.reverse(this.string);return this};e.prototype.upper=function(){var t;t=1<=arguments.length?p.call(arguments,0):[];this.string=e.upper.apply(e,[this.string].concat(p.call(t)));return this};e.prototype.lower=function(){var t;t=1<=arguments.length?p.call(arguments,0):[];this.string=e.lower.apply(e,[this.string].concat(p.call(t)));return this};e.prototype.shuffle=function(){this.string=e.shuffle(this.string);return this};e.prototype.toCamel=function(t){this.string=e.toCamel(this.string,t);return this};e.prototype.unCamel=function(t){this.string=e.unCamel(this.string,t);return this};e.prototype.startsWith=function(t){return e.startsWith(this.string,t)};e.prototype.endsWith=function(t){return e.endsWith(this.string,t)};e.prototype.setWrap=function(t,r){if(f.isNull(this.wrapMethod)){this.wrapMethod=e.wrap(t,r)}else{this.wrapMethod.wrap(t,r)}return this};e.prototype.removeWrap=function(){this.wrapMethod=null;return this};e.prototype.applyWrap=function(t,r){this.string=this.setWrap(t,r).wrap;this.removeWrap();return this};return e}(t);n.crop=n.slice;if(typeof window!=="undefined"&&window!==null){window.Strings=n}else{module.exports=n}}).call(this);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc