Comparing version 0.4.3 to 0.4.4
{ | ||
"name": "words.js", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "A library/toolbox for working with words and strings.", | ||
"main": "words.min.js", | ||
"scripts": { | ||
"uglify": "uglifyjs words.js -c -m -o words.min.js", | ||
"uglify": "terser words.js -c -m -o words.min.js", | ||
"build": "coffee -c --transpile words.coffee && npm run uglify", | ||
@@ -25,3 +25,3 @@ "test": "jasmine" | ||
], | ||
"author": "Dennis Raymondo <phazelift@gmail.com> (https://github.com/phazelift/)", | ||
"author": "dennis raymondo van der sluis", | ||
"license": "MIT", | ||
@@ -28,0 +28,0 @@ "bugs": { |
22
words.js
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -23,5 +23,5 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
@@ -36,5 +36,5 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
// Generated by CoffeeScript 2.5.1 | ||
// Generated by CoffeeScript 2.7.0 | ||
(function () { | ||
@@ -41,0 +41,0 @@ // words.coffee - A Javascript word-string manipulation library, written in Coffeescript. |
@@ -1,1 +0,1 @@ | ||
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){return(_setPrototypeOf=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function _createSuper(n){return function(){var t,r=_getPrototypeOf(n);if(_isNativeReflectConstruct()){var e=_getPrototypeOf(this).constructor;t=Reflect.construct(r,arguments,e)}else t=r.apply(this,arguments);return _possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(t,r){return!r||"object"!==_typeof(r)&&"function"!=typeof r?_assertThisInitialized(t):r}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(e):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,r):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _createClass(t,r,e){return r&&_defineProperties(t.prototype,r),e&&_defineProperties(t,e),t}(function(){var t,p,r,l,y,e;e=(p=y=require("strings.js")).Types,t=p.Chars,l=function(){var t=function(){function h(){_classCallCheck(this,h)}return _createClass(h,null,[{key:"stringsFromArray",value:function(t){var r,e,n,o,i;for(o=[],r=0,e=(n=y.forceArray(t)).length;r<e;r++)i=n[r],y.isString(i)&&o.push(i);return o}},{key:"numbersFromArray",value:function(t){var r,e,n,o,i;for(n=[],r=0,e=(o=y.forceArray(t)).length;r<e;r++)i=o[r],y.isNumber(i)&&n.push(i+0);return n}},{key:"changeCase",value:function(n,t){var r,o,e,i,s,u,f,a,l,c;c=h.stringsFromArray(t),e=h.numbersFromArray(t),0<c.length&&this.set(p[n].apply(p,[this.string].concat(_toConsumableArray(c))));if(0===e[0]){for(a=[],r=0,s=e.length;r<s;r++)f=e[r],a.push(function(){var t,r,e;for(e=[],o=t=0,r=this.count-1;0<=r?t<=r:r<=t;o=0<=r?++t:--t)e.push(this.words[o]=p[n](this.words[o],f));return e}.call(this));return a}for(t.length<1&&(e=function(){for(var t=[],r=0,e=this.count;0<=e?r<=e:e<=r;0<=e?r++:r--)t.push(r);return t}.apply(this)),l=[],i=0,u=e.length;i<u;i++)o=e[i],o=y.positiveIndex(o,this.count),l.push(this.words[o]=p[n](this.words[o]));return l}},{key:"applyToValidIndex",value:function(t,r,e){var n;if(!1!==(n=y.positiveIndex(t,r)))return e(n)}}]),h}();return t.delimiter=" ",t}.call(this),r=function(){_inherits(u,p);var o=_createSuper(u);function u(){for(var t,r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return _classCallCheck(this,u),(t=o.call(this)).set.apply(_assertThisInitialized(t),arguments),t}return _createClass(u,[{key:"set",value:function(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];var n,o,i,s,u,f,a;if(this.words=[],(r=y.intoArray.apply(this,r)).length<1)return this;for(o=0,s=r.length;o<s;o++)for(n=r[o],i=0,u=(f=p.split(p.create(n),l.delimiter)).length;i<u;i++)a=f[i],this.words.push(a);return this}},{key:"get",value:function(){var t,r,e,n;if(arguments.length<1)return this.words.join(l.delimiter);for(n="",t=0,e=arguments.length;t<e;t++)r=arguments[t],!1!==(r=y.positiveIndex(r,this.count))&&(n+=this.words[r]+l.delimiter);return p.trim(n)}},{key:"xs",value:function(t){var r,e,n,o,i,s,u,f=0<arguments.length&&void 0!==t?t:function(){return!0};if(y.notFunction(f)||this.count<1)return this;for(s=[],e=r=0,n=(o=this.words).length;r<n;e=++r)(i=f(u=o[e],e))&&(!0===i?s.push(u):y.isStringOrNumber(i)&&s.push(i+""));return this.words=s,this}},{key:"find",value:function(e){var n;return n=[],""!==(e=y.forceString(e))&&this.xs(function(t,r){return t===e&&n.push(r+1),!0}),n}},{key:"upper",value:function(){return l.changeCase.call(this,"upper",Array.prototype.slice.call(arguments)),this}},{key:"lower",value:function(){return l.changeCase.call(this,"lower",Array.prototype.slice.call(arguments)),this}},{key:"reverse",value:function(t){var r,e,n,o=this;if(0===(null!=arguments?t:void 0))this.xs(function(t){return p.reverse(t)});else if(0<arguments.length)for(e=0,n=arguments.length;e<n;e++)r=arguments[e],l.applyToValidIndex(r,this.count,function(t){return o.words[t]=p.reverse(o.words[t])});else this.xs(function(t,r){return o.get(o.count-r)});return this}},{key:"shuffle",value:function(t){var e,r,n,o,i,s=this;if(null!=t)if(y.isString(t))for(r=0,o=arguments.length;r<o;r++)e=arguments[r],this.xs(function(t,r){return t!==e||p.shuffle(t)});else if(0===t)this.xs(function(t){return p.shuffle(t)});else for(n=0,i=arguments.length;n<i;n++)e=arguments[n],l.applyToValidIndex(e,this.count,function(t){return s.words[t]=p.shuffle(s.words[t])});else this.words=y.shuffleArray(this.words);return this}},{key:"clear",value:function(){return this.words=[],this}},{key:"remove",value:function(){var e,t,r,n,o,i,s;if(arguments.length<1)return this;for(t=[],r=0,i=arguments.length;r<i;r++)e=arguments[r],y.isString(e)?t.unshift(e):y.isNumber(e)&&t.push(u.positiveIndex(e,this.count));for(n=o=0,s=(t=y.noDupAndReverse(y.insertSort(t))).length;o<s;n=++o)e=t[n],y.isNumber(e)?this.xs(function(t,r){if(r!==e)return!0}):y.isString(e)&&this.xs(function(t){if(t!==e)return!0});return this}},{key:"pop",value:function(t){var r,e,n,o;for(n="",r=1,o=t=Math.abs(y.forceNumber(t,1));1<=o?r<=o:o<=r;1<=o?++r:--r)e=this.words.pop(),void 0!==e&&(n=e+" "+n);return n.trim()}},{key:"push",value:function(){var t,r,e;for(r=0,e=arguments.length;r<e;r++)t=arguments[r],""!==(t=y.forceString(t))&&this.words.push(p.trim(t));return this}},{key:"shift",value:function(t){var r,e;for(r=1,e=t=y.forceNumber(t,1);1<=e?r<=e:e<=r;1<=e?++r:--r)this.words.shift();return this}},{key:"prepend",value:function(){var t,r,e,n;for(r=n=0,e=arguments.length;r<e;r++)t=arguments[r],""!==(t=y.forceString(t))&&(this.words.splice(n,0,p.trim(t)),n++);return this}},{key:"insert",value:function(t){var r,e,n,o;t=y.positiveIndex(t,this.count),n=0;for(var i=arguments.length,s=new Array(1<i?i-1:0),u=1;u<i;u++)s[u-1]=arguments[u];for(r=0,e=s.length;r<e;r++)o=s[r],""!==(o=y.forceString(o))&&(this.words.splice(t+n,0,p.trim(o)),n++);return this}},{key:"replace",value:function(r,t){var e=this,n=1<arguments.length&&void 0!==t?t:"";return""===(n=p.trim(n))||(y.isNumber(r)?l.applyToValidIndex(r,this.count,function(t){return e.words.splice(t,1,n)}):this.xs(function(t){return t!==r||n})),this}},{key:"sort",value:function(){return y.insertSort(this.words),this}},{key:"startsWith",value:function(t){var e,n=this;return""!==(t=y.forceString(t))&&(e=!0,(t=new u(t)).xs(function(t,r){if(t!==n.words[r])return e=!1}),e)}},{key:"endsWith",value:function(t){var r,e,n,o,i;if(""===(t=y.forceString(t)))return!1;for(i=!0,r=1,n=e=o=(t=new u(t)).count;o<=1?e<=1:1<=e;n=o<=1?++e:--e)t.get(n)!==this.words[this.count-r++]&&(i=!1);return i}}]),u}(),Object.defineProperty(r.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(r.prototype,"string",{get:function(){return this.get()}}),Object.defineProperty(r.prototype,"count",{get:function(){return this.words.length}}),r.prototype.unshift=r.prototype.prepend,r.flexArgs=e.intoArray,r.Strings=p,r.types=e,r.Chars=t,"undefined"!=typeof define&&null!==define&&"function"==typeof define&&define.amd?define("words",[],function(){return r}):"undefined"!=typeof window&&null!==window?(window.Words=r,window.types=e,window.Strings=p):"undefined"!=typeof module&&null!==module&&(module.exports=r)}).call(void 0); | ||
"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},_setPrototypeOf(t,r)}function _createSuper(t){var r=_isNativeReflectConstruct();return function(){var e,n=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return _possibleConstructorReturn(this,e)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,r):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _createClass(t,r,e){return r&&_defineProperties(t.prototype,r),e&&_defineProperties(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function(){var t,r,e,n,o,i;i=(r=o=require("strings.js")).Types,t=r.Chars,n=function(){var t=function(){function t(){_classCallCheck(this,t)}return _createClass(t,null,[{key:"stringsFromArray",value:function(t){var r,e,n,i,s;for(i=[],r=0,e=(n=o.forceArray(t)).length;r<e;r++)s=n[r],o.isString(s)&&i.push(s);return i}},{key:"numbersFromArray",value:function(t){var r,e,n,i,s;for(n=[],r=0,e=(i=o.forceArray(t)).length;r<e;r++)s=i[r],o.isNumber(s)&&n.push(s+0);return n}},{key:"changeCase",value:function(e,n){var i,s,u,f,a,l,c,h,p,y,d;(y=t.stringsFromArray(n),u=t.numbersFromArray(n),y.length>0)&&this.set((d=r)[e].apply(d,[this.string].concat(_toConsumableArray(y))));if(0===u[0]){for(h=[],i=0,a=u.length;i<a;i++)c=u[i],h.push(function(){var t,n,o;for(o=[],s=t=0,n=this.count-1;0<=n?t<=n:t>=n;s=0<=n?++t:--t)o.push(this.words[s]=r[e](this.words[s],c));return o}.call(this));return h}for(n.length<1&&(u=function(){for(var t=[],r=0,e=this.count;0<=e?r<=e:r>=e;0<=e?r++:r--)t.push(r);return t}.apply(this)),p=[],f=0,l=u.length;f<l;f++)s=u[f],s=o.positiveIndex(s,this.count),p.push(this.words[s]=r[e](this.words[s]));return p}},{key:"applyToValidIndex",value:function(t,r,e){var n;if(!1!==(n=o.positiveIndex(t,r)))return e(n)}}]),t}();return t.delimiter=" ",t}.call(this),e=function(t){_inherits(i,t);var e=_createSuper(i);function i(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return _classCallCheck(this,i),(t=e.call(this)).set.apply(_assertThisInitialized(t),arguments),t}return _createClass(i,[{key:"set",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var s,u,f,a,l,c,h;if(this.words=[],(e=o.intoArray.apply(this,e)).length<1)return this;for(u=0,a=e.length;u<a;u++)for(s=e[u],f=0,l=(c=r.split(r.create(s),n.delimiter)).length;f<l;f++)h=c[f],this.words.push(h);return this}},{key:"get",value:function(){var t,e,i,s;if(arguments.length<1)return this.words.join(n.delimiter);for(s="",t=0,i=arguments.length;t<i;t++)e=arguments[t],!1!==(e=o.positiveIndex(e,this.count))&&(s+=this.words[e]+n.delimiter);return r.trim(s)}},{key:"xs",value:function(){var t,r,e,n,i,s,u,f=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0};if(o.notFunction(f)||this.count<1)return this;for(s=[],r=t=0,e=(n=this.words).length;t<e;r=++t)(i=f(u=n[r],r))&&(!0===i?s.push(u):o.isStringOrNumber(i)&&s.push(i+""));return this.words=s,this}},{key:"find",value:function(t){var r;return r=[],""!==(t=o.forceString(t))&&this.xs((function(e,n){return e===t&&r.push(n+1),!0})),r}},{key:"upper",value:function(){return n.changeCase.call(this,"upper",Array.prototype.slice.call(arguments)),this}},{key:"lower",value:function(){return n.changeCase.call(this,"lower",Array.prototype.slice.call(arguments)),this}},{key:"reverse",value:function(){var t,e,o,i=this;if(0===(null!=arguments?arguments[0]:void 0))this.xs((function(t){return r.reverse(t)}));else if(arguments.length>0)for(e=0,o=arguments.length;e<o;e++)t=arguments[e],n.applyToValidIndex(t,this.count,(function(t){return i.words[t]=r.reverse(i.words[t])}));else this.xs((function(t,r){return i.get(i.count-r)}));return this}},{key:"shuffle",value:function(t){var e,i,s,u,f,a=this;if(null!=t)if(o.isString(t))for(i=0,u=arguments.length;i<u;i++)e=arguments[i],this.xs((function(t,n){return t!==e||r.shuffle(t)}));else if(0===t)this.xs((function(t){return r.shuffle(t)}));else for(s=0,f=arguments.length;s<f;s++)e=arguments[s],n.applyToValidIndex(e,this.count,(function(t){return a.words[t]=r.shuffle(a.words[t])}));else this.words=o.shuffleArray(this.words);return this}},{key:"clear",value:function(){return this.words=[],this}},{key:"remove",value:function(){var t,r,e,n,s,u,f;if(arguments.length<1)return this;for(r=[],e=0,u=arguments.length;e<u;e++)t=arguments[e],o.isString(t)?r.unshift(t):o.isNumber(t)&&r.push(i.positiveIndex(t,this.count));for(n=s=0,f=(r=o.noDupAndReverse(o.insertSort(r))).length;s<f;n=++s)t=r[n],o.isNumber(t)?this.xs((function(r,e){if(e!==t)return!0})):o.isString(t)&&this.xs((function(r){if(r!==t)return!0}));return this}},{key:"pop",value:function(t){var r,e,n,i;for(n="",r=1,i=t=Math.abs(o.forceNumber(t,1));1<=i?r<=i:r>=i;1<=i?++r:--r)e=this.words.pop(),void 0!==e&&(n=e+" "+n);return n.trim()}},{key:"push",value:function(){var t,e,n;for(e=0,n=arguments.length;e<n;e++)t=arguments[e],""!==(t=o.forceString(t))&&this.words.push(r.trim(t));return this}},{key:"shift",value:function(t){var r,e;for(r=1,e=t=o.forceNumber(t,1);1<=e?r<=e:r>=e;1<=e?++r:--r)this.words.shift();return this}},{key:"prepend",value:function(){var t,e,n,i;for(i=0,e=0,n=arguments.length;e<n;e++)t=arguments[e],""!==(t=o.forceString(t))&&(this.words.splice(i,0,r.trim(t)),i++);return this}},{key:"insert",value:function(t){var e,n,i,s;t=o.positiveIndex(t,this.count),i=0;for(var u=arguments.length,f=new Array(u>1?u-1:0),a=1;a<u;a++)f[a-1]=arguments[a];for(e=0,n=f.length;e<n;e++)s=f[e],""!==(s=o.forceString(s))&&(this.words.splice(t+i,0,r.trim(s)),i++);return this}},{key:"replace",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return""===(i=r.trim(i))||(o.isNumber(t)?n.applyToValidIndex(t,this.count,(function(t){return e.words.splice(t,1,i)})):this.xs((function(r){return r!==t||i}))),this}},{key:"sort",value:function(){return o.insertSort(this.words),this}},{key:"startsWith",value:function(t){var r,e=this;return""!==(t=o.forceString(t))&&(r=!0,(t=new i(t)).xs((function(t,n){if(t!==e.words[n])return r=!1})),r)}},{key:"endsWith",value:function(t){var r,e,n,s,u;if(""===(t=o.forceString(t)))return!1;for(u=!0,r=1,n=e=s=(t=new i(t)).count;s<=1?e<=1:e>=1;n=s<=1?++e:--e)t.get(n)!==this.words[this.count-r++]&&(u=!1);return u}}]),i}(r),Object.defineProperty(e.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(e.prototype,"string",{get:function(){return this.get()}}),Object.defineProperty(e.prototype,"count",{get:function(){return this.words.length}}),e.prototype.unshift=e.prototype.prepend,e.flexArgs=i.intoArray,e.Strings=r,e.types=i,e.Chars=t,"undefined"!=typeof define&&null!==define&&"function"==typeof define&&define.amd?define("words",[],(function(){return e})):"undefined"!=typeof window&&null!==window?(window.Words=e,window.types=i,window.Strings=r):"undefined"!=typeof module&&null!==module&&(module.exports=e)}).call(void 0); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
241147
18
4835
3
1