Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "words.js", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "A flexible, robust and powerful Javascript word-string manipulation library.", | ||
@@ -5,0 +5,0 @@ "main": "words.min.js", |
@@ -422,3 +422,3 @@ // Generated by CoffeeScript 1.8.0 | ||
if (typeof window !== "undefined" && window !== null) { | ||
return window.Words; | ||
return window.Words = Words; | ||
} | ||
@@ -425,0 +425,0 @@ |
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";var t,r,n,e,o,i,s,u,h,f=[].slice,p={}.hasOwnProperty,c=function(t,r){function n(){this.constructor=t}for(var e in r)p.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t};return r=t=h=require("strings.js"),u=function(t){var r,n,e,o;for(n=t.length-1,e=[],r=o=n;0>=n?0>=o:o>=0;r=0>=n?++o:--o)e[e.length-1]!==t[r]&&e.push(t[r]);return e},s=function(t){var r,n,e,o,i;for(e=t.length-1,n=i=1;e>=1?e>=i:i>=e;n=e>=1?++i:--i){for(r=t[n],o=n-1;o>=0&&t[o]>r;)t[o+1]=t[o],--o;t[+o+1]=r}return t},o=function(r,n){var e,o,i,s,u,p,c,l,g;if(h.isString(null!=n?n[0]:void 0))return this.set(t[r].apply(t,[this.$].concat(f.call(n))));if(0===(null!=n?n[0]:void 0)){for(c=[],i=0,u=n.length;u>i;i++)o=n[i],c.push(function(){var n,i,s;for(s=[],e=n=0,i=this.count-1;i>=0?i>=n:n>=i;e=i>=0?++n:--n)s.push(this.words[e]=t[r](this.words[e],o));return s}.call(this));return c}for(n.length<1&&(n=function(){l=[];for(var t=0,r=this.count;r>=0?r>=t:t>=r;r>=0?t++:t--)l.push(t);return l}.apply(this)),g=[],s=0,p=n.length;p>s;s++)o=n[s],o=h.positiveIndex(o,this.count),g.push(this.words[o]=t[r](this.words[o]));return g},e=function(){return function(t,r,n){var e;return!1!==(e=h.positiveIndex(t,r))?n(e):void 0}}(this),i=" ",n=function(r){function n(){this.set.apply(this,arguments)}return c(n,r),n.prototype.set=function(){var r,n,e,o,s,u,h;if(arguments.length<1)return this;for(this.words=[],e=0,s=arguments.length;s>e;e++)for(r=arguments[e],h=t.split(t.create(r),i),o=0,u=h.length;u>o;o++)n=h[o],this.words.push(n);return this},n.prototype.get=function(){var r,n,e,o;if(arguments.length<1)return this.words.join(i);for(n="",e=0,o=arguments.length;o>e;e++)r=arguments[e],r=h.positiveIndex(r,this.count),r!==!1&&(n+=this.words[r]+i);return t.trim(n)},n.prototype.xs=function(t){var r,n,e,o,i,s,u;if(null==t&&(t=function(){return!0}),!(h.notFunction(t)||this.count<1)){for(e=[],u=this.words,r=i=0,s=u.length;s>i;r=++i)o=u[r],(n=t(o,r))&&(n===!0?e.push(o):h.isStringOrNumber(n)&&e.push(n+""));return this.words=e,this}},n.prototype.find=function(t){var r;return r=[],""!==(t=h.forceString(t))&&this.xs(function(n,e){return n===t&&r.push(e+1),!0}),r},n.prototype.upper=function(){return o.call(this,"upper",Array.prototype.slice.call(arguments)),this},n.prototype.lower=function(){return o.call(this,"lower",Array.prototype.slice.call(arguments)),this},n.prototype.reverse=function(){var r,n,o;if(0===(null!=arguments?arguments[0]:void 0))this.xs(function(r){return t.reverse(r)});else if(arguments.length>0)for(n=0,o=arguments.length;o>n;n++)r=arguments[n],e(r,this.count,function(r){return function(n){return r.words[n]=t.reverse(r.words[n])}}(this));else this.xs(function(t){return function(r,n){return t.get(t.count-n)}}(this));return this},n.prototype.shuffle=function(r){var n,o,i,s,u;if(null!=r)if(h.isString(r))for(o=0,s=arguments.length;s>o;o++)n=arguments[o],this.xs(function(){return function(r){return r===n?t.shuffle(r):!0}}(this));else if(0===r)this.xs(function(r){return t.shuffle(r)});else for(i=0,u=arguments.length;u>i;i++)n=arguments[i],e(n,this.count,function(r){return function(n){return r.words[n]=t.shuffle(r.words[n])}}(this));else this.words=h.shuffleArray(this.words);return this},n.prototype.clear=function(){return this.words=[],this},n.prototype.remove=function(){var t,r,e,o,i,f,p;if(arguments.length<1)return this;for(r=[],o=0,f=arguments.length;f>o;o++)t=arguments[o],h.isString(t)?r.unshift(t):h.isNumber(t)&&r.push(n.positiveIndex(t,this.count));for(r=u(s(r)),e=i=0,p=r.length;p>i;e=++i)t=r[e],h.isNumber(t)?this.xs(function(){return function(r,n){return n!==t?!0:void 0}}(this)):h.isString(t)&&this.xs(function(r){return r!==t?!0:void 0});return this},n.prototype.pop=function(t){var r,n;for(t=h.forceNumber(t,1),r=n=1;t>=1?t>=n:n>=t;r=t>=1?++n:--n)this.words.pop();return this},n.prototype.push=function(){var r,n,e;for(n=0,e=arguments.length;e>n;n++)r=arguments[n],""!==(r=h.forceString(r))&&this.words.push(t.trim(r));return this},n.prototype.shift=function(t){var r,n;for(t=h.forceNumber(t,1),r=n=1;t>=1?t>=n:n>=t;r=t>=1?++n:--n)this.words.shift();return this},n.prototype.prepend=function(){var r,n,e,o;for(n=e=0,o=arguments.length;o>e;n=++e)r=arguments[n],""!==(r=h.forceString(r))&&this.words.splice(n,0,t.trim(r));return this},n.prototype.insert=function(){var r,n,e,o,i,s;for(n=arguments[0],o=2<=arguments.length?f.call(arguments,1):[],n=h.positiveIndex(n,this.count),r=i=0,s=o.length;s>i;r=++i)e=o[r],""!==(e=h.forceString(e))&&this.words.splice(n+r,0,t.trim(e));return this},n.prototype.replace=function(r,n){return null==n&&(n=""),""===(n=t.trim(n))?this:(h.isNumber(r)?e(r,this.count,function(t){return function(r){return t.words.splice(r,1,n)}}(this)):this.xs(function(t){return t===r?n:!0}),this)},n.prototype.sort=function(){return s(this.words),this},n.prototype.startsWith=function(t){var r;return""===(t=h.forceString(t))?!1:(r=!0,t=new n(t),t.xs(function(t){return function(n,e){return n!==t.words[e]?r=!1:void 0}}(this)),r)},n.prototype.endsWith=function(t){var r,e,o,i,s;if(""===(t=h.forceString(t)))return!1;for(o=!0,r=1,t=new n(t),e=i=s=t.count;1>=s?1>=i:i>=1;e=1>=s?++i:--i)t.get(e)!==this.words[this.count-r++]&&(o=!1);return o},n}(r),Object.defineProperty(n.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(n.prototype,"string",{get:function(){return this.get()}}),Object.defineProperty(n.prototype,"count",{get:function(){return this.words.length}}),n.prototype.unshift=n.prototype.prepend,n.Strings=r,n.Types=r.Types,n.Chars=r.Chars,"undefined"!=typeof window&&null!==window?window.Words:module?module.exports=n:void 0}).call(this); | ||
(function(){"use strict";var t,r,n,e,o,i,s,u,h,f=[].slice,p={}.hasOwnProperty,c=function(t,r){function n(){this.constructor=t}for(var e in r)p.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t};return r=t=h=require("strings.js"),u=function(t){var r,n,e,o;for(n=t.length-1,e=[],r=o=n;0>=n?0>=o:o>=0;r=0>=n?++o:--o)e[e.length-1]!==t[r]&&e.push(t[r]);return e},s=function(t){var r,n,e,o,i;for(e=t.length-1,n=i=1;e>=1?e>=i:i>=e;n=e>=1?++i:--i){for(r=t[n],o=n-1;o>=0&&t[o]>r;)t[o+1]=t[o],--o;t[+o+1]=r}return t},o=function(r,n){var e,o,i,s,u,p,c,l,g;if(h.isString(null!=n?n[0]:void 0))return this.set(t[r].apply(t,[this.$].concat(f.call(n))));if(0===(null!=n?n[0]:void 0)){for(c=[],i=0,u=n.length;u>i;i++)o=n[i],c.push(function(){var n,i,s;for(s=[],e=n=0,i=this.count-1;i>=0?i>=n:n>=i;e=i>=0?++n:--n)s.push(this.words[e]=t[r](this.words[e],o));return s}.call(this));return c}for(n.length<1&&(n=function(){l=[];for(var t=0,r=this.count;r>=0?r>=t:t>=r;r>=0?t++:t--)l.push(t);return l}.apply(this)),g=[],s=0,p=n.length;p>s;s++)o=n[s],o=h.positiveIndex(o,this.count),g.push(this.words[o]=t[r](this.words[o]));return g},e=function(){return function(t,r,n){var e;return!1!==(e=h.positiveIndex(t,r))?n(e):void 0}}(this),i=" ",n=function(r){function n(){this.set.apply(this,arguments)}return c(n,r),n.prototype.set=function(){var r,n,e,o,s,u,h;if(arguments.length<1)return this;for(this.words=[],e=0,s=arguments.length;s>e;e++)for(r=arguments[e],h=t.split(t.create(r),i),o=0,u=h.length;u>o;o++)n=h[o],this.words.push(n);return this},n.prototype.get=function(){var r,n,e,o;if(arguments.length<1)return this.words.join(i);for(n="",e=0,o=arguments.length;o>e;e++)r=arguments[e],r=h.positiveIndex(r,this.count),r!==!1&&(n+=this.words[r]+i);return t.trim(n)},n.prototype.xs=function(t){var r,n,e,o,i,s,u;if(null==t&&(t=function(){return!0}),!(h.notFunction(t)||this.count<1)){for(e=[],u=this.words,r=i=0,s=u.length;s>i;r=++i)o=u[r],(n=t(o,r))&&(n===!0?e.push(o):h.isStringOrNumber(n)&&e.push(n+""));return this.words=e,this}},n.prototype.find=function(t){var r;return r=[],""!==(t=h.forceString(t))&&this.xs(function(n,e){return n===t&&r.push(e+1),!0}),r},n.prototype.upper=function(){return o.call(this,"upper",Array.prototype.slice.call(arguments)),this},n.prototype.lower=function(){return o.call(this,"lower",Array.prototype.slice.call(arguments)),this},n.prototype.reverse=function(){var r,n,o;if(0===(null!=arguments?arguments[0]:void 0))this.xs(function(r){return t.reverse(r)});else if(arguments.length>0)for(n=0,o=arguments.length;o>n;n++)r=arguments[n],e(r,this.count,function(r){return function(n){return r.words[n]=t.reverse(r.words[n])}}(this));else this.xs(function(t){return function(r,n){return t.get(t.count-n)}}(this));return this},n.prototype.shuffle=function(r){var n,o,i,s,u;if(null!=r)if(h.isString(r))for(o=0,s=arguments.length;s>o;o++)n=arguments[o],this.xs(function(){return function(r){return r===n?t.shuffle(r):!0}}(this));else if(0===r)this.xs(function(r){return t.shuffle(r)});else for(i=0,u=arguments.length;u>i;i++)n=arguments[i],e(n,this.count,function(r){return function(n){return r.words[n]=t.shuffle(r.words[n])}}(this));else this.words=h.shuffleArray(this.words);return this},n.prototype.clear=function(){return this.words=[],this},n.prototype.remove=function(){var t,r,e,o,i,f,p;if(arguments.length<1)return this;for(r=[],o=0,f=arguments.length;f>o;o++)t=arguments[o],h.isString(t)?r.unshift(t):h.isNumber(t)&&r.push(n.positiveIndex(t,this.count));for(r=u(s(r)),e=i=0,p=r.length;p>i;e=++i)t=r[e],h.isNumber(t)?this.xs(function(){return function(r,n){return n!==t?!0:void 0}}(this)):h.isString(t)&&this.xs(function(r){return r!==t?!0:void 0});return this},n.prototype.pop=function(t){var r,n;for(t=h.forceNumber(t,1),r=n=1;t>=1?t>=n:n>=t;r=t>=1?++n:--n)this.words.pop();return this},n.prototype.push=function(){var r,n,e;for(n=0,e=arguments.length;e>n;n++)r=arguments[n],""!==(r=h.forceString(r))&&this.words.push(t.trim(r));return this},n.prototype.shift=function(t){var r,n;for(t=h.forceNumber(t,1),r=n=1;t>=1?t>=n:n>=t;r=t>=1?++n:--n)this.words.shift();return this},n.prototype.prepend=function(){var r,n,e,o;for(n=e=0,o=arguments.length;o>e;n=++e)r=arguments[n],""!==(r=h.forceString(r))&&this.words.splice(n,0,t.trim(r));return this},n.prototype.insert=function(){var r,n,e,o,i,s;for(n=arguments[0],o=2<=arguments.length?f.call(arguments,1):[],n=h.positiveIndex(n,this.count),r=i=0,s=o.length;s>i;r=++i)e=o[r],""!==(e=h.forceString(e))&&this.words.splice(n+r,0,t.trim(e));return this},n.prototype.replace=function(r,n){return null==n&&(n=""),""===(n=t.trim(n))?this:(h.isNumber(r)?e(r,this.count,function(t){return function(r){return t.words.splice(r,1,n)}}(this)):this.xs(function(t){return t===r?n:!0}),this)},n.prototype.sort=function(){return s(this.words),this},n.prototype.startsWith=function(t){var r;return""===(t=h.forceString(t))?!1:(r=!0,t=new n(t),t.xs(function(t){return function(n,e){return n!==t.words[e]?r=!1:void 0}}(this)),r)},n.prototype.endsWith=function(t){var r,e,o,i,s;if(""===(t=h.forceString(t)))return!1;for(o=!0,r=1,t=new n(t),e=i=s=t.count;1>=s?1>=i:i>=1;e=1>=s?++i:--i)t.get(e)!==this.words[this.count-r++]&&(o=!1);return o},n}(r),Object.defineProperty(n.prototype,"$",{get:function(){return this.get()}}),Object.defineProperty(n.prototype,"string",{get:function(){return this.get()}}),Object.defineProperty(n.prototype,"count",{get:function(){return this.words.length}}),n.prototype.unshift=n.prototype.prepend,n.Strings=r,n.Types=r.Types,n.Chars=r.Chars,"undefined"!=typeof window&&null!==window?window.Words=n:module?module.exports=n:void 0}).call(this); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72616
7