strings.js
Advanced tools
Comparing version 1.2.8 to 1.2.9
{ | ||
"name": "strings.js", | ||
"version": "1.2.8", | ||
"description": "A friendly Javascript string manipulation library.", | ||
"version": "1.2.9", | ||
"description": "A Javascript string manipulation library", | ||
"main": "strings.min.js", | ||
@@ -16,3 +16,2 @@ "scripts": { | ||
"strings", | ||
"manipulation", | ||
"tool", | ||
@@ -26,3 +25,6 @@ "utility" | ||
}, | ||
"homepage": "https://github.com/phazelift/strings.js" | ||
"homepage": "https://github.com/phazelift/strings.js", | ||
"dependencies": { | ||
"types.js": "latest" | ||
} | ||
} |
strings.js | ||
========== | ||
<br/> | ||
A friendly Javascript string manipulation library. No cryptic names, no methods returning undefined when you expect | ||
a string, etc.. Contains the usual suspects and some handy additions. | ||
A Javascript string manipulation library. No cryptic names, no methods returning undefined when you expect a string, etc.. Contains the usual suspects and some handy additions. | ||
@@ -16,3 +16,4 @@ **key features:** | ||
***String.prototype is not affected by strings.js*** | ||
<br/> | ||
______________________________________________ | ||
@@ -60,3 +61,3 @@ ### a quick example: | ||
paths: { | ||
'strings', [ 'path/to/strings.min(.js)' ] | ||
'strings', [ 'path/to/strings.min.js' ] | ||
} | ||
@@ -90,6 +91,5 @@ }); | ||
types.js essential type-checker/enforcer is included in strings.js. It is the fundament for strings.js and can be found after | ||
loading strings.js like so: | ||
types.js essential type-checker/enforcer is included in strings.js. It is the fundament for strings.js and can be found after loading strings.js. | ||
```javascript | ||
var _= Strings.Types; | ||
var types= Strings.Types; | ||
``` | ||
@@ -900,2 +900,12 @@ | ||
========== | ||
**1.2.8** | ||
Removes the included types.js code. For node.js there are no changes, but if you want to load strings.js in the browser you'll now first have to load types.js: | ||
>```html | ||
<script src="your-path-to-js-libs/types.min.js"></script> | ||
<script src="your-path-to-js-libs/strings.min.js"></script> | ||
``` | ||
--- | ||
**1.2.7** | ||
@@ -902,0 +912,0 @@ |
324
strings.js
@@ -0,184 +1,18 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
"use strict"; | ||
var Chars, LITERALS, Strings, TYPES, Types, asciiStringType, breakIfEqual, changeCase, 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; }, | ||
__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; }; | ||
var Chars, Strings, Types, _, asciiStringType, changeCase, mapStringToNumber, | ||
extend = 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; }, | ||
hasProp = {}.hasOwnProperty, | ||
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; }; | ||
instanceOf = function(type, value) { | ||
return value instanceof type; | ||
}; | ||
_ = Types = require('types.js'); | ||
typeOf = function(value, type) { | ||
if (type == null) { | ||
type = 'object'; | ||
} | ||
return typeof value === type; | ||
}; | ||
LITERALS = { | ||
'Boolean': false, | ||
'String': '', | ||
'Object': {}, | ||
'Array': [], | ||
'Function': function() {}, | ||
'Number': (function() { | ||
var number; | ||
number = new Number; | ||
number["void"] = true; | ||
return number; | ||
})() | ||
}; | ||
TYPES = { | ||
'Undefined': function(value) { | ||
return value === void 0; | ||
}, | ||
'Null': function(value) { | ||
return value === null; | ||
}, | ||
'Function': function(value) { | ||
return typeOf(value, 'function'); | ||
}, | ||
'Boolean': function(value) { | ||
return typeOf(value, 'boolean'); | ||
}, | ||
'String': function(value) { | ||
return typeOf(value, 'string'); | ||
}, | ||
'Array': function(value) { | ||
return typeOf(value) && instanceOf(Array, value); | ||
}, | ||
'RegExp': function(value) { | ||
return typeOf(value) && instanceOf(RegExp, value); | ||
}, | ||
'Date': function(value) { | ||
return typeOf(value) && instanceOf(Date, value); | ||
}, | ||
'Number': function(value) { | ||
return typeOf(value, 'number') && (value === value) || (typeOf(value) && instanceOf(Number, value)); | ||
}, | ||
'Object': function(value) { | ||
return typeOf(value) && (value !== null) && !instanceOf(Boolean, value) && !instanceOf(Number, value) && !instanceOf(Array, value) && !instanceOf(RegExp, value) && !instanceOf(Date, value); | ||
}, | ||
'NaN': function(value) { | ||
return typeOf(value, 'number') && (value !== value); | ||
}, | ||
'Defined': function(value) { | ||
return value !== void 0; | ||
} | ||
}; | ||
TYPES.StringOrNumber = function(value) { | ||
return TYPES.String(value) || TYPES.Number(value); | ||
}; | ||
Types = _ = { | ||
parseIntBase: 10 | ||
}; | ||
createForce = function(type) { | ||
var convertType; | ||
convertType = function(value) { | ||
switch (type) { | ||
case 'Number': | ||
if ((_.isNumber(value = parseInt(value, _.parseIntBase))) && !value["void"]) { | ||
return value; | ||
} | ||
break; | ||
case 'String': | ||
if (_.isStringOrNumber(value)) { | ||
return value + ''; | ||
} | ||
break; | ||
default: | ||
if (Types['is' + type](value)) { | ||
return value; | ||
} | ||
} | ||
}; | ||
return function(value, replacement) { | ||
if ((value != null) && void 0 !== (value = convertType(value))) { | ||
return value; | ||
} | ||
if ((replacement != null) && void 0 !== (replacement = convertType(replacement))) { | ||
return replacement; | ||
} | ||
return LITERALS[type]; | ||
}; | ||
}; | ||
testValues = function(predicate, breakState, values) { | ||
var value, _i, _len; | ||
if (values == null) { | ||
values = []; | ||
} | ||
if (values.length < 1) { | ||
return predicate === TYPES.Undefined; | ||
} | ||
for (_i = 0, _len = values.length; _i < _len; _i++) { | ||
value = values[_i]; | ||
if (predicate(value) === breakState) { | ||
return breakState; | ||
} | ||
} | ||
return !breakState; | ||
}; | ||
breakIfEqual = true; | ||
(function() { | ||
var name, predicate, _results; | ||
_results = []; | ||
for (name in TYPES) { | ||
predicate = TYPES[name]; | ||
_results.push((function(name, predicate) { | ||
Types['is' + name] = predicate; | ||
Types['not' + name] = function(value) { | ||
return !predicate(value); | ||
}; | ||
Types['has' + name] = function() { | ||
return testValues(predicate, breakIfEqual, arguments); | ||
}; | ||
Types['all' + name] = function() { | ||
return testValues(predicate, !breakIfEqual, arguments); | ||
}; | ||
if (name in LITERALS) { | ||
return Types['force' + name] = createForce(name); | ||
} | ||
})(name, predicate)); | ||
} | ||
return _results; | ||
})(); | ||
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) { | ||
var name, predicate; | ||
for (name in TYPES) { | ||
predicate = TYPES[name]; | ||
if (predicate(value) === true) { | ||
return name.toLowerCase(); | ||
} | ||
} | ||
}; | ||
mapStringToNumber = function(array) { | ||
var index, nr, value, _i, _len; | ||
var index, j, len, nr, value; | ||
if (_.notArray(array)) { | ||
return 0; | ||
} | ||
for (index = _i = 0, _len = array.length; _i < _len; index = ++_i) { | ||
for (index = j = 0, len = array.length; j < len; index = ++j) { | ||
value = array[index]; | ||
@@ -194,4 +28,4 @@ nr = _.forceNumber(value); | ||
_ = (function(_super) { | ||
__extends(_, _super); | ||
_ = (function(superClass) { | ||
extend(_, superClass); | ||
@@ -235,3 +69,3 @@ function _() { | ||
_.shuffleArray = function(array) { | ||
var i, length, rand, temp, _i; | ||
var i, j, length, rand, ref, temp; | ||
if (_.notArray(array) || array.length < 1) { | ||
@@ -241,3 +75,3 @@ return []; | ||
length = array.length - 1; | ||
for (i = _i = length; length <= 0 ? _i <= 0 : _i >= 0; i = length <= 0 ? ++_i : --_i) { | ||
for (i = j = ref = length; ref <= 0 ? j <= 0 : j >= 0; i = ref <= 0 ? ++j : --j) { | ||
rand = _.randomNumber(0, i); | ||
@@ -266,5 +100,5 @@ temp = array[i]; | ||
_.insertSort = function(array) { | ||
var current, index, length, prev, _i; | ||
var current, index, j, length, prev, ref; | ||
length = array.length - 1; | ||
for (index = _i = 1; 1 <= length ? _i <= length : _i >= length; index = 1 <= length ? ++_i : --_i) { | ||
for (index = j = 1, ref = length; 1 <= ref ? j <= ref : j >= ref; index = 1 <= ref ? ++j : --j) { | ||
current = array[index]; | ||
@@ -282,6 +116,6 @@ prev = index - 1; | ||
_.noDupAndReverse = function(array) { | ||
var index, length, newArr, _i; | ||
var index, j, length, newArr, ref; | ||
length = array.length - 1; | ||
newArr = []; | ||
for (index = _i = length; length <= 0 ? _i <= 0 : _i >= 0; index = length <= 0 ? ++_i : --_i) { | ||
for (index = j = ref = length; ref <= 0 ? j <= 0 : j >= 0; index = ref <= 0 ? ++j : --j) { | ||
if (newArr[newArr.length - 1] !== array[index]) { | ||
@@ -295,5 +129,5 @@ newArr.push(array[index]); | ||
_.sortNoDupAndReverse = function(array, maxLength) { | ||
var index, processed, value, _i, _len; | ||
var index, j, len, processed, value; | ||
processed = []; | ||
for (index = _i = 0, _len = array.length; _i < _len; index = ++_i) { | ||
for (index = j = 0, len = array.length; j < len; index = ++j) { | ||
value = array[index]; | ||
@@ -316,4 +150,4 @@ value = _.forceNumber(value); | ||
Chars = (function(_super) { | ||
__extends(Chars, _super); | ||
Chars = (function(superClass) { | ||
extend(Chars, superClass); | ||
@@ -363,4 +197,4 @@ function Chars() { | ||
changeCase = function() { | ||
var arg, args, caseMethod, pos, string, _i, _j, _len, _len1; | ||
string = arguments[0], caseMethod = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : []; | ||
var arg, args, caseMethod, j, k, len, len1, pos, string; | ||
string = arguments[0], caseMethod = arguments[1], args = 3 <= arguments.length ? slice.call(arguments, 2) : []; | ||
if (string == null) { | ||
@@ -375,4 +209,4 @@ string = ''; | ||
} else if (_.isNumber(args[0])) { | ||
for (_i = 0, _len = args.length; _i < _len; _i++) { | ||
arg = args[_i]; | ||
for (j = 0, len = args.length; j < len; j++) { | ||
arg = args[j]; | ||
pos = _.positiveIndex(arg, string.length); | ||
@@ -387,4 +221,4 @@ string = Strings.xs(string, function(char, index) { | ||
} else if (_.isString(args[0])) { | ||
for (_j = 0, _len1 = args.length; _j < _len1; _j++) { | ||
arg = args[_j]; | ||
for (k = 0, len1 = args.length; k < len1; k++) { | ||
arg = args[k]; | ||
string = Strings.replace(string, arg, arg[caseMethod](), 'gi'); | ||
@@ -397,8 +231,8 @@ } | ||
asciiStringType = function(string, method) { | ||
var char, _i, _len; | ||
var char, j, len; | ||
if ('' === (string = _.forceString(string))) { | ||
return false; | ||
} | ||
for (_i = 0, _len = string.length; _i < _len; _i++) { | ||
char = string[_i]; | ||
for (j = 0, len = string.length; j < len; j++) { | ||
char = string[j]; | ||
if (!method(char)) { | ||
@@ -411,4 +245,4 @@ return false; | ||
Strings = (function(_super) { | ||
__extends(Strings, _super); | ||
Strings = (function(superClass) { | ||
extend(Strings, superClass); | ||
@@ -420,6 +254,6 @@ Strings.Types = Types; | ||
Strings.create = function() { | ||
var arg, string, _i, _len; | ||
var arg, j, len, string; | ||
string = ''; | ||
for (_i = 0, _len = arguments.length; _i < _len; _i++) { | ||
arg = arguments[_i]; | ||
for (j = 0, len = arguments.length; j < len; j++) { | ||
arg = arguments[j]; | ||
string += _.forceString(arg); | ||
@@ -431,4 +265,4 @@ } | ||
Strings.get = function() { | ||
var argsLength, length, pos, positions, result, string, _i; | ||
string = arguments[0], positions = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
var argsLength, j, length, pos, positions, ref, result, string; | ||
string = arguments[0], positions = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
if (arguments.length < 2) { | ||
@@ -441,3 +275,3 @@ return ''; | ||
argsLength = arguments.length; | ||
for (pos = _i = 1; 1 <= argsLength ? _i <= argsLength : _i >= argsLength; pos = 1 <= argsLength ? ++_i : --_i) { | ||
for (pos = j = 1, ref = argsLength; 1 <= ref ? j <= ref : j >= ref; pos = 1 <= ref ? ++j : --j) { | ||
pos = _.positiveIndex(arguments[pos], length); | ||
@@ -457,6 +291,6 @@ if (pos !== false) { | ||
Strings.random = function(amount, charSet) { | ||
var i, string, _i; | ||
var i, j, ref, string; | ||
amount = _.forceNumber(amount, 1); | ||
string = ''; | ||
for (i = _i = 1; 1 <= amount ? _i <= amount : _i >= amount; i = 1 <= amount ? ++_i : --_i) { | ||
for (i = j = 1, ref = amount; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) { | ||
string += Chars.random(charSet); | ||
@@ -485,3 +319,3 @@ } | ||
return Strings.xs(string, function(char) { | ||
if (__indexOf.call(Chars.REGEXP_SPECIAL_CHARS, char) >= 0) { | ||
if (indexOf.call(Chars.REGEXP_SPECIAL_CHARS, char) >= 0) { | ||
return '\\' + char; | ||
@@ -545,3 +379,3 @@ } | ||
Strings.xs = function(string, callback) { | ||
var index, length, response, result, _i; | ||
var index, j, length, ref, response, result; | ||
if (string == null) { | ||
@@ -558,3 +392,3 @@ string = ''; | ||
result = ''; | ||
for (index = _i = 0; 0 <= length ? _i <= length : _i >= length; index = 0 <= length ? ++_i : --_i) { | ||
for (index = j = 0, ref = length; 0 <= ref ? j <= ref : j >= ref; index = 0 <= ref ? ++j : --j) { | ||
if (response = callback(string[index], index)) { | ||
@@ -583,3 +417,3 @@ if (response === true) { | ||
Strings.replace = function(string, toReplace, replacement, flags) { | ||
var _ref; | ||
var ref; | ||
if (string == null) { | ||
@@ -597,3 +431,3 @@ string = ''; | ||
} | ||
if (!(_.isStringOrNumber(string) && ((_ref = _["typeof"](toReplace)) === 'string' || _ref === 'number' || _ref === 'regexp'))) { | ||
if (!(_.isStringOrNumber(string) && ((ref = _["typeof"](toReplace)) === 'string' || ref === 'number' || ref === 'regexp'))) { | ||
return _.forceString(string); | ||
@@ -684,3 +518,3 @@ } | ||
Strings.between = function(string, before, after) { | ||
var reg, _ref; | ||
var ref, reg; | ||
if (!_.allStringOrNumber(string, before, after)) { | ||
@@ -692,3 +526,3 @@ return ''; | ||
reg = new RegExp(before + '(.+)' + after); | ||
return ((_ref = reg.exec(string + '')) != null ? _ref[1] : void 0) || ''; | ||
return ((ref = reg.exec(string + '')) != null ? ref[1] : void 0) || ''; | ||
}; | ||
@@ -720,3 +554,3 @@ | ||
Strings.split = function(string, delimiter) { | ||
var array, result, word, _i, _len; | ||
var array, j, len, result, word; | ||
string = Strings.oneSpaceAndTrim(string); | ||
@@ -729,4 +563,4 @@ result = []; | ||
array = string.split(delimiter[0] || ''); | ||
for (_i = 0, _len = array.length; _i < _len; _i++) { | ||
word = array[_i]; | ||
for (j = 0, len = array.length; j < len; j++) { | ||
word = array[j]; | ||
if (word.match(/^\s$/)) { | ||
@@ -741,3 +575,3 @@ continue; | ||
Strings.reverse = function(string) { | ||
var ch, length, reversed, _i; | ||
var ch, j, length, ref, reversed; | ||
if (string == null) { | ||
@@ -751,3 +585,3 @@ string = ''; | ||
reversed = ''; | ||
for (ch = _i = length; length <= 0 ? _i <= 0 : _i >= 0; ch = length <= 0 ? ++_i : --_i) { | ||
for (ch = j = ref = length; ref <= 0 ? j <= 0 : j >= 0; ch = ref <= 0 ? ++j : --j) { | ||
reversed += string[ch]; | ||
@@ -760,4 +594,4 @@ } | ||
var args, string; | ||
string = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
return changeCase.apply(null, [string, 'toUpperCase'].concat(__slice.call(args))); | ||
string = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
return changeCase.apply(null, [string, 'toUpperCase'].concat(slice.call(args))); | ||
}; | ||
@@ -767,9 +601,9 @@ | ||
var args, string; | ||
string = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
return changeCase.apply(null, [string, 'toLowerCase'].concat(__slice.call(args))); | ||
string = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
return changeCase.apply(null, [string, 'toLowerCase'].concat(slice.call(args))); | ||
}; | ||
Strings.insert = function() { | ||
var index, insertion, posCount, positions, string, _i; | ||
string = arguments[0], insertion = arguments[1], positions = 3 <= arguments.length ? __slice.call(arguments, 2) : []; | ||
var index, insertion, j, posCount, positions, ref, string; | ||
string = arguments[0], insertion = arguments[1], positions = 3 <= arguments.length ? slice.call(arguments, 2) : []; | ||
if (('' === (string = _.forceString(string))) || ('' === (insertion = _.forceString(insertion)))) { | ||
@@ -783,3 +617,3 @@ return string; | ||
} | ||
for (index = _i = 0; 0 <= posCount ? _i <= posCount : _i >= posCount; index = 0 <= posCount ? ++_i : --_i) { | ||
for (index = j = 0, ref = posCount; 0 <= ref ? j <= ref : j >= ref; index = 0 <= ref ? ++j : --j) { | ||
index = positions[index]; | ||
@@ -811,11 +645,11 @@ if (index > string.length) { | ||
var pos, positions, string; | ||
string = arguments[0], positions = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
string = arguments[0], positions = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
if ('' === (string = _.forceString(string))) { | ||
return ''; | ||
} | ||
pos = positions.map(function(value, index) { | ||
pos = positions.map(function(value) { | ||
return _.positiveIndex(value, string.length); | ||
}); | ||
return Strings.xs(string, function(char, index) { | ||
if (!(__indexOf.call(pos, index) >= 0)) { | ||
if (!(indexOf.call(pos, index) >= 0)) { | ||
return true; | ||
@@ -827,4 +661,4 @@ } | ||
Strings.remove = function() { | ||
var remove, string, toRemove, _i, _len; | ||
string = arguments[0], toRemove = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
var j, len, remove, string, toRemove; | ||
string = arguments[0], toRemove = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
if (string == null) { | ||
@@ -836,4 +670,4 @@ string = ''; | ||
} | ||
for (_i = 0, _len = toRemove.length; _i < _len; _i++) { | ||
remove = toRemove[_i]; | ||
for (j = 0, len = toRemove.length; j < len; j++) { | ||
remove = toRemove[j]; | ||
string = Strings.replace(string, remove); | ||
@@ -919,7 +753,7 @@ } | ||
Strings.prototype.get = function() { | ||
var position, string, _i, _len; | ||
var j, len, position, string; | ||
if (arguments.length > 0) { | ||
string = ''; | ||
for (_i = 0, _len = arguments.length; _i < _len; _i++) { | ||
position = arguments[_i]; | ||
for (j = 0, len = arguments.length; j < len; j++) { | ||
position = arguments[j]; | ||
position = _.positiveIndex(position, this.length); | ||
@@ -992,4 +826,4 @@ if (position !== false) { | ||
var positions, string; | ||
string = arguments[0], positions = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
this.string = Strings.insert.apply(Strings, [this.string, string].concat(__slice.call(positions))); | ||
string = arguments[0], positions = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
this.string = Strings.insert.apply(Strings, [this.string, string].concat(slice.call(positions))); | ||
return this; | ||
@@ -1051,4 +885,4 @@ }; | ||
var strings; | ||
strings = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
this.string = Strings.remove.apply(Strings, [this.string].concat(__slice.call(strings))); | ||
strings = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
this.string = Strings.remove.apply(Strings, [this.string].concat(slice.call(strings))); | ||
return this; | ||
@@ -1064,4 +898,4 @@ }; | ||
var positions; | ||
positions = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
this.string = Strings.removePos.apply(Strings, [this.string].concat(__slice.call(positions))); | ||
positions = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
this.string = Strings.removePos.apply(Strings, [this.string].concat(slice.call(positions))); | ||
return this; | ||
@@ -1082,4 +916,4 @@ }; | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
this.string = Strings.upper.apply(Strings, [this.string].concat(__slice.call(args))); | ||
args = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
this.string = Strings.upper.apply(Strings, [this.string].concat(slice.call(args))); | ||
return this; | ||
@@ -1090,4 +924,4 @@ }; | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
this.string = Strings.lower.apply(Strings, [this.string].concat(__slice.call(args))); | ||
args = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
this.string = Strings.lower.apply(Strings, [this.string].concat(slice.call(args))); | ||
return this; | ||
@@ -1094,0 +928,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";var t,r,n,e,i,o,u,s,c,f,p,a,g,l,h=[].slice,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},S=[].indexOf||function(t){for(var r=0,n=this.length;n>r;r++)if(r in this&&this[r]===t)return r;return-1};f=function(t,r){return r instanceof t},g=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}()},e={Undefined:function(t){return void 0===t},Null:function(t){return null===t},Function:function(t){return g(t,"function")},Boolean:function(t){return g(t,"boolean")},String:function(t){return g(t,"string")},Array:function(t){return g(t)&&f(Array,t)},RegExp:function(t){return g(t)&&f(RegExp,t)},Date:function(t){return g(t)&&f(Date,t)},Number:function(t){return g(t,"number")&&t===t||g(t)&&f(Number,t)},Object:function(t){return!(!g(t)||null===t||f(Boolean,t)||f(Number,t)||f(Array,t)||f(RegExp,t)||f(Date,t))},NaN:function(t){return g(t,"number")&&t!==t},Defined:function(t){return void 0!==t}},e.StringOrNumber=function(t){return e.String(t)||e.Number(t)},i=l={parseIntBase:10},c=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(i["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]}},a=function(t,r,n){var i,o,u;if(null==n&&(n=[]),n.length<1)return t===e.Undefined;for(o=0,u=n.length;u>o;o++)if(i=n[o],t(i)===r)return r;return!r},u=!0,function(){var t,n,o;o=[];for(t in e)n=e[t],o.push(function(t,n){return i["is"+t]=n,i["not"+t]=function(t){return!n(t)},i["has"+t]=function(){return a(n,u,arguments)},i["all"+t]=function(){return a(n,!u,arguments)},t in r?i["force"+t]=c(t):void 0}(t,n));return o}(),i.intoArray=function(){var t;return t=1<=arguments.length?h.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},i["typeof"]=function(t){var r,n;for(r in e)if(n=e[r],n(t)===!0)return r.toLowerCase()},p=function(t){var r,n,e,i,o;if(l.notArray(t))return 0;for(r=i=0,o=t.length;o>i;r=++i){if(e=t[r],n=l.forceNumber(e),n["void"])return r;t[r]=n}return t.length},l=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return y(r,t),r.inRange=function(t,n){return r.isNaN(t=parseInt(t,10))||p(n)<2?!1:t>=n[0]&&t<=n[1]},r.limitNumber=function(t,n){return t=r.forceNumber(t,0),p(n)<2?t:t<n[0]?n[0]:t>n[1]?n[1]:t},r.randomNumber=function(t,r){return p([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}(i),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),s=function(){var t,r,e,i,o,u,s,c,f;if(o=arguments[0],e=arguments[1],r=3<=arguments.length?h.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},o=function(t,r){var n,e,i;if(""===(t=l.forceString(t)))return!1;for(e=0,i=t.length;i>e;e++)if(n=t[e],!r(n))return!1;return!0},n=function(r){function n(){this.set.apply(this,arguments),this.wrapMethod=null,this.crop=this.slice}return y(n,r),n.Types=i,n.Chars=t,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?h.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 S.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?h.call(arguments,1):[],s.apply(null,[r,"toUpperCase"].concat(h.call(t)))},n.lower=function(){var t,r;return r=arguments[0],t=2<=arguments.length?h.call(arguments,1):[],s.apply(null,[r,"toLowerCase"].concat(h.call(t)))},n.insert=function(){var t,r,n,e,i,o;if(i=arguments[0],r=arguments[1],e=3<=arguments.length?h.call(arguments,2):[],""===(i=l.forceString(i))||""===(r=l.forceString(r)))return i;if(e=l.sortNoDupAndReverse(e,i.length),n=p(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?h.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 S.call(t,n)>=0?void 0:!0}))},n.remove=function(){var t,r,e,i,o;if(r=arguments[0],e=2<=arguments.length?h.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.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.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?h.call(arguments,1):[],this.string=n.insert.apply(n,[this.string,r].concat(h.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?h.call(arguments,0):[],this.string=n.remove.apply(n,[this.string].concat(h.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?h.call(arguments,0):[],this.string=n.removePos.apply(n,[this.string].concat(h.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?h.call(arguments,0):[],this.string=n.upper.apply(n,[this.string].concat(h.call(t))),this},n.prototype.lower=function(){var t;return t=1<=arguments.length?h.call(arguments,0):[],this.string=n.lower.apply(n,[this.string].concat(h.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.crop=n.slice,n.prototype.crop=n.prototype.slice,n.prototype.append=n.prototype.push,"undefined"!=typeof define&&null!==define&&"function"==typeof define&&define.amd?define("strings",[],function(){return n}):"undefined"!=typeof module&&null!==module?module.exports=n:"undefined"!=typeof window&&null!==window&&(window.Types=i,window.Strings=n)}).call(this); | ||
(function(){"use strict";var t,r,n,e,i,o,u,s=function(t,r){function n(){this.constructor=t}for(var e in r)c.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},c={}.hasOwnProperty,p=[].slice,g=[].indexOf||function(t){for(var r=0,n=this.length;n>r;r++)if(r in this&&this[r]===t)return r;return-1};e=n=require("types.js"),u=function(t){var r,n,i,o,u;if(e.notArray(t))return 0;for(r=n=0,i=t.length;i>n;r=++n){if(u=t[r],o=e.forceNumber(u),o["void"])return r;t[r]=o}return t.length},e=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return s(r,t),r.inRange=function(t,n){return r.isNaN(t=parseInt(t,10))||u(n)<2?!1:t>=n[0]&&t<=n[1]},r.limitNumber=function(t,n){return t=r.forceNumber(t,0),u(n)<2?t:t<n[0]?n[0]:t>n[1]?n[1]:t},r.randomNumber=function(t,r){return u([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,s;if(r.notArray(t)||t.length<1)return[];for(i=t.length-1,n=e=u=i;0>=u?0>=e:e>=0;n=0>=u?++e:--e)o=r.randomNumber(0,n),s=t[n],t[n]=t[o],t[o]=s;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,u;for(i=t.length-1,n=e=1,u=i;u>=1?u>=e:e>=u;n=u>=1?++e:--e){for(r=t[n],o=n-1;o>=0&&t[o]>r;)t[o+1]=t[o],--o;t[+o+1]=r}return t},r.noDupAndReverse=function(t){var r,n,e,i,o;for(e=t.length-1,i=[],r=n=o=e;0>=o?0>=n:n>=0;r=0>=o?++n:--n)i[i.length-1]!==t[r]&&i.push(t[r]);return i},r.sortNoDupAndReverse=function(t,n){var e,i,o,u,s;for(u=[],e=i=0,o=t.length;o>i;e=++i)s=t[e],s=r.forceNumber(s),s["void"]||(n>=s&&(s=r.positiveIndex(s,n)),u.push(r.forceNumber(s,0)));return r.noDupAndReverse(r.insertSort(u))},r}(n),t=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return s(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(e.forceNumber(t))},r.ordinal=function(t){return e.forceNumber(e.forceString(t).charCodeAt(),0)},r.random=function(t){var n,i;return t=e.forceArray(t,r.ASCII_RANGE_ALL),i=e.limitNumber(t[0],t),n=e.limitNumber(t[1],t),r.ascii(e.randomNumber(i,n))},r}(e),o=function(){var t,n,i,o,u,s,c,g,f;if(f=arguments[0],i=arguments[1],n=3<=arguments.length?p.call(arguments,2):[],null==f&&(f=""),""===(f=e.forceString(f)))return f;if(n.length<1||void 0===n[0])return f[i]();if(e.isNumber(n[0]))for(o=0,s=n.length;s>o;o++)t=n[o],g=e.positiveIndex(t,f.length),f=r.xs(f,function(t,r){return r===g?t[i]():t});else if(e.isString(n[0]))for(u=0,c=n.length;c>u;u++)t=n[u],f=r.replace(f,t,t[i](),"gi");return f},i=function(t,r){var n,i,o;if(""===(t=e.forceString(t)))return!1;for(i=0,o=t.length;o>i;i++)if(n=t[i],!r(n))return!1;return!0},r=function(r){function i(){this.set.apply(this,arguments),this.wrapMethod=null,this.crop=this.slice}return s(i,r),i.Types=n,i.Chars=t,i.create=function(){var t,r,n,i;for(i="",r=0,n=arguments.length;n>r;r++)t=arguments[r],i+=e.forceString(t);return i},i.get=function(){var t,r,n,i,o,u,s,c;if(c=arguments[0],o=2<=arguments.length?p.call(arguments,1):[],arguments.length<2)return"";for(c=e.forceString(c),n=c.length,s="",t=arguments.length,i=r=1,u=t;u>=1?u>=r:r>=u;i=u>=1?++r:--r)i=e.positiveIndex(arguments[i],n),i!==!1&&(s+=c[i]);return s},i.sort=function(t){return t=e.forceString(t).trim().split(""),e.insertSort(t).join("")},i.random=function(r,n){var i,o,u,s;for(r=e.forceNumber(r,1),s="",i=o=1,u=r;u>=1?u>=o:o>=u;i=u>=1?++o:--o)s+=t.random(n);return s},i.times=function(t,r){var n;if(""===(t=e.forceString(t)))return"";for(r=e.forceNumber(r,1),n="";r-->0;)n+=t;return n},i.regEscape=function(r){return""===(r=e.forceString(r))?r:i.xs(r,function(r){return g.call(t.REGEXP_SPECIAL_CHARS,r)>=0?"\\"+r:!0})},i.empty=function(t){return e.notString(t)||t.length>0?!1:!0},i.isAlpha=function(t){return""===(t=e.forceString(t))?!1:/^[a-z]*$/gi.test(t)},i.isNumeric=function(t){return""===(t=e.forceString(t))?!1:/^[0-9]*$/g.test(t)},i.isAlphaNumeric=function(t){return""===(t=e.forceString(t))?!1:/^[0-9|a-z]*$/gi.test(t)},i.isSpecial=function(t){return""===(t=e.forceString(t))?!1:/^[^0-9|a-z]*$/gi.test(t)},i.isSpace=function(t){return/^[ \t]+$/g.test(t)},i.hasUpper=function(t){return/[A-Z]+/g.test(t)},i.isUpper=function(t){return/^[A-Z]+$/g.test(t)},i.isLower=function(t){return/^[a-z]+$/g.test(t)},i.xs=function(t,r){var n,i,o,u,s,c;if(null==t&&(t=""),t=e.forceString(t),-1===(o=t.length-1))return"";for(r=e.forceFunction(r,function(t){return t}),c="",n=i=0,u=o;u>=0?u>=i:i>=u;n=u>=0?++i:--i)(s=r(t[n],n))&&(s===!0?c+=t[n]:e.isStringOrNumber(s)&&(c+=s));return c},i.copy=function(t,r,n){return r=e.forceNumber(r),""===(t=e.forceString(t))||Math.abs(r)>t.length?"":(r>0&&(r-=1),t.substr(r,e.forceNumber(n,t.length)))},i.replace=function(t,r,n,o){var u;return null==t&&(t=""),null==r&&(r=""),null==n&&(n=""),null==o&&(o="g"),!e.isStringOrNumber(t)||"string"!==(u=e["typeof"](r))&&"number"!==u&&"regexp"!==u?e.forceString(t):(e.notRegExp(r)&&(r=i.regEscape(r+""),r=new RegExp(r,o)),(t+"").replace(r,n))},i.trim=function(t){return i.replace(t,/^\s+|\s+$/g)},i.trimLeft=function(t){return i.replace(t,/^\s+/g)},i.trimRight=function(t){return i.replace(t,/\s+$/g)},i.oneSpace=function(t){return i.replace(t,/\s+/g," ")},i.oneSpaceAndTrim=function(t){return i.oneSpace(i.trim(t))},i.toCamel=function(t,r){var n;return t=e.forceString(t),r=e.forceString(r,"-"),n=new RegExp(i.regEscape(r)+"([a-z])","ig"),i.replace(t,n,function(t,r){return r.toUpperCase()})},i.unCamel=function(t,r){return t=e.forceString(t),r=e.forceString(r,"-"),i.replace(t,/([A-Z])/g,r+"$1").toLowerCase()},i.shuffle=function(t){return t=e.forceString(t),e.shuffleArray((t+"").split("")).join("")},i.find=function(t,r,n){var o,u;if(o=[],""===(t=e.forceString(t)))return o;if(n=e.forceString(n,"g"),e.isStringOrNumber(r))r=new RegExp(i.regEscape(r+""),n);else{if(!e.isRegExp(r))return o;r=new RegExp(r.source,n)}if(r.global)for(;u=r.exec(t);)o.push(u.index+1);else(u=r.exec(t))&&o.push(u.index+1);return o},i.count=function(t,r){return i.find(t,r).length},i.contains=function(t,r){return i.count(t,r)>0},i.between=function(t,r,n){var o,u;return e.allStringOrNumber(t,r,n)?(r=i.regEscape(r+""),n=i.regEscape(n+""),u=new RegExp(r+"(.+)"+n),(null!=(o=u.exec(t+""))?o[1]:void 0)||""):""},i.slice=function(t,r,n){return t=e.forceString(t),r=e.forceNumber(r||1),!1!==(r=e.positiveIndex(r,t.length))?(n=e.forceNumber(n),t.slice(r,r+n)):""},i.truncate=function(t,r,n){return t=e.forceString(t),r=e.forceNumber(r,t.length),t=i.slice(t,1,r),t+e.forceString(n)},i.pop=function(t,r){return t=e.forceString(t),r=e.forceNumber(r,1),t.slice(0,-Math.abs(r))},i.split=function(t,r){var n,o,u,s,c;if(t=i.oneSpaceAndTrim(t),s=[],t.length<1)return s;for(r=e.forceString(r," "),n=t.split(r[0]||""),o=0,u=n.length;u>o;o++)c=n[o],c.match(/^\s$/)||s.push(i.trim(c));return s},i.reverse=function(t){var r,n,i,o,u;if(null==t&&(t=""),t=e.forceString(t),(i=t.length-1)<1)return t;for(u="",r=n=o=i;0>=o?0>=n:n>=0;r=0>=o?++n:--n)u+=t[r];return u},i.upper=function(){var t,r;return r=arguments[0],t=2<=arguments.length?p.call(arguments,1):[],o.apply(null,[r,"toUpperCase"].concat(p.call(t)))},i.lower=function(){var t,r;return r=arguments[0],t=2<=arguments.length?p.call(arguments,1):[],o.apply(null,[r,"toLowerCase"].concat(p.call(t)))},i.insert=function(){var t,r,n,i,o,s,c;if(c=arguments[0],r=arguments[1],o=3<=arguments.length?p.call(arguments,2):[],""===(c=e.forceString(c))||""===(r=e.forceString(r)))return c;if(o=e.sortNoDupAndReverse(o,c.length),i=u(o)-1,0>i)return c;for(t=n=0,s=i;s>=0?s>=n:n>=s;t=s>=0?++n:--n)t=o[t],t>c.length?c+=r:c=c.substr(0,t)+r+c.substr(t);return c},i.removeRange=function(t,r,n){var o;return t=e.forceString(t),""===t||!1===(r=e.positiveIndex(r,t.length))||0>(n=e.forceNumber(n,1))?t:(o=r+n,i.xs(t,function(t,n){return r>n||n>=o?!0:void 0}))},i.removePos=function(){var t,r,n;return n=arguments[0],r=2<=arguments.length?p.call(arguments,1):[],""===(n=e.forceString(n))?"":(t=r.map(function(t){return e.positiveIndex(t,n.length)}),i.xs(n,function(r,n){return g.call(t,n)>=0?void 0:!0}))},i.remove=function(){var t,r,n,o,u;if(o=arguments[0],u=2<=arguments.length?p.call(arguments,1):[],null==o&&(o=""),""===(o=e.forceString(o))||u.length<1)return o;for(t=0,r=u.length;r>t;t++)n=u[t],o=i.replace(o,n);return o},i.startsWith=function(t,r){return""===(t=e.forceString(t))||""===(r=e.forceString(r))?!1:(r=new RegExp("^"+i.regEscape(r)),r.test(t))},i.endsWith=function(t,r){return""===(t=e.forceString(t))||""===(r=e.forceString(r))?!1:(r=new RegExp(i.regEscape(r)+"$"),r.test(t))},i.wrap=function(t,r){var n;return null==t&&(t=""),null==r&&(r=""),n=function(n){return i.create(t,n,r)},n.wrap=function(n,i){return null==n&&(n=""),null==i&&(i=""),t=e.forceString(n)+t,r+=e.forceString(i)},n},i.prototype.set=function(){return this.string=i.create.apply(this,arguments),this},i.prototype.sort=function(){return this.string=i.sort(this.string),this},i.prototype.random=function(t,r){return this.string=i.random(t,r),this},i.prototype.xs=function(t){return this.string=i.xs(this.string,t),this},i.prototype.times=function(t){return null==t&&(t=1),this.string=i.times(this.string,t),this},i.prototype.get=function(){var t,r,n,i;if(arguments.length>0){for(i="",t=0,r=arguments.length;r>t;t++)n=arguments[t],n=e.positiveIndex(n,this.length),n!==!1&&(i+=this.string[n]);return i}return this.string},i.prototype.copy=function(t,r){return i.copy(this.string,t,r)},i.prototype.empty=function(){return i.empty(this.string)},i.prototype.isAlpha=function(){return i.isAlpha(this.string)},i.prototype.isNumeric=function(){return i.isNumeric(this.string)},i.prototype.isAlphaNumeric=function(){return i.isAlphaNumeric(this.string)},i.prototype.isSpecial=function(){return i.isSpecial(this.string)},i.prototype.isUpper=function(){return i.isUpper(this.string)},i.prototype.hasUpper=function(){return i.hasUpper(this.string)},i.prototype.isLower=function(){return i.isLower(this.string)},i.prototype.isSpace=function(){return i.isSpace(this.string)},i.prototype.push=function(){return this.string=this.string+i.create.apply(this,arguments),this},i.prototype.prepend=function(){return this.string=i.create.apply(this,arguments)+this.string,this},i.prototype.pop=function(t){return this.string=i.pop(this.string,t),this},i.prototype.insert=function(){var t,r;return r=arguments[0],t=2<=arguments.length?p.call(arguments,1):[],this.string=i.insert.apply(i,[this.string,r].concat(p.call(t))),this},i.prototype.trim=function(){return this.string=i.trim(this.string),this},i.prototype.trimLeft=function(){return this.string=i.trimLeft(this.string),this},i.prototype.trimRight=function(){return this.string=i.trimRight(this.string),this},i.prototype.oneSpace=function(){return this.string=i.oneSpace(this.string),this},i.prototype.oneSpaceAndTrim=function(){return this.string=i.oneSpaceAndTrim(this.string),this},i.prototype.find=function(t){return i.find(this.string,t)},i.prototype.count=function(t){return i.count(this.string,t)},i.prototype.contains=function(t){return i.contains(this.string,t)},i.prototype.between=function(t,r){return i.between(this.string,t,r)},i.prototype.slice=function(t,r){return this.string=i.slice(this.string,t,r),this},i.prototype.truncate=function(t,r){return this.string=i.truncate(this.string,t,r),this},i.prototype.remove=function(){var t;return t=1<=arguments.length?p.call(arguments,0):[],this.string=i.remove.apply(i,[this.string].concat(p.call(t))),this},i.prototype.removeRange=function(t,r){return this.string=i.removeRange(this.string,t,r),this},i.prototype.removePos=function(){var t;return t=1<=arguments.length?p.call(arguments,0):[],this.string=i.removePos.apply(i,[this.string].concat(p.call(t))),this},i.prototype.replace=function(t,r,n){return this.string=i.replace(this.string,t,r,n),this},i.prototype.reverse=function(){return this.string=i.reverse(this.string),this},i.prototype.upper=function(){var t;return t=1<=arguments.length?p.call(arguments,0):[],this.string=i.upper.apply(i,[this.string].concat(p.call(t))),this},i.prototype.lower=function(){var t;return t=1<=arguments.length?p.call(arguments,0):[],this.string=i.lower.apply(i,[this.string].concat(p.call(t))),this},i.prototype.shuffle=function(){return this.string=i.shuffle(this.string),this},i.prototype.toCamel=function(t){return this.string=i.toCamel(this.string,t),this},i.prototype.unCamel=function(t){return this.string=i.unCamel(this.string,t),this},i.prototype.startsWith=function(t){return i.startsWith(this.string,t)},i.prototype.endsWith=function(t){return i.endsWith(this.string,t)},i.prototype.setWrap=function(t,r){return e.isNull(this.wrapMethod)?this.wrapMethod=i.wrap(t,r):this.wrapMethod.wrap(t,r),this},i.prototype.removeWrap=function(){return this.wrapMethod=null,this},i.prototype.applyWrap=function(t,r){return this.string=this.setWrap(t,r).wrap,this.removeWrap(),this},i}(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 e.isNull(this.wrapMethod)?this.string:this.wrapMethod(this.string)}}),r.crop=r.slice,r.prototype.crop=r.prototype.slice,r.prototype.append=r.prototype.push,"undefined"!=typeof define&&null!==define&&"function"==typeof define&&define.amd?define("strings",[],function(){return r}):"undefined"!=typeof module&&null!==module?module.exports=r:"undefined"!=typeof window&&null!==window&&(window.Types=n,window.Strings=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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
980
204375
1
9
2374
2
+ Addedtypes.js@latest
+ Addedtypes.js@2.0.1(transitive)