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

words.js

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

words.js - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

package.json
{
"name": "words.js",
"version": "0.2.1",
"version": "0.2.2",
"description": "A flexible, robust and powerful Javascript word-string manipulation library.",

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

@@ -89,17 +89,2 @@ // Generated by CoffeeScript 1.8.0

function Words() {
Object.defineProperty(this, '$', {
get: function() {
return this.get();
}
});
Object.defineProperty(this, 'string', {
get: function() {
return this.get();
}
});
Object.defineProperty(this, 'count', {
get: function() {
return this.words.length;
}
});
this.set.apply(this, arguments);

@@ -411,2 +396,20 @@ }

Object.defineProperty(Words.prototype, '$', {
get: function() {
return this.get();
}
});
Object.defineProperty(Words.prototype, 'string', {
get: function() {
return this.get();
}
});
Object.defineProperty(Words.prototype, 'count', {
get: function() {
return this.words.length;
}
});
Words.prototype.unshift = Words.prototype.prepend;

@@ -413,0 +416,0 @@

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

(function(){"use strict";var t,r,n,e,i,s,o,u,h,f=[].slice,c={}.hasOwnProperty,p=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};return r=t=h=require("strings.js"),u=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},o=function(t){var r,n,e,i,s;for(e=t.length-1,n=s=1;e>=1?e>=s:s>=e;n=e>=1?++s:--s){for(r=t[n],i=n-1;i>=0&&t[i]>r;)t[i+1]=t[i],--i;t[+i+1]=r}return t},i=function(r,n){var e,i,s,o,u,c,p,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(p=[],s=0,u=n.length;u>s;s++)i=n[s],p.push(function(){var n,s,o;for(o=[],e=n=0,s=this.count-1;s>=0?s>=n:n>=s;e=s>=0?++n:--n)o.push(this.words[e]=t[r](this.words[e],i));return o}.call(this));return p}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=[],o=0,c=n.length;c>o;o++)i=n[o],i=h.positiveIndex(i,this.count),g.push(this.words[i]=t[r](this.words[i]));return g},e=function(){return function(t,r,n){var e;return!1!==(e=h.positiveIndex(t,r))?n(e):void 0}}(this),s=" ",n=function(r){function n(){Object.defineProperty(this,"$",{get:function(){return this.get()}}),Object.defineProperty(this,"string",{get:function(){return this.get()}}),Object.defineProperty(this,"count",{get:function(){return this.words.length}}),this.set.apply(this,arguments)}return p(n,r),n.prototype.set=function(){var r,n,e,i,o,u,h;if(arguments.length<1)return this;for(this.words=[],e=0,o=arguments.length;o>e;e++)for(r=arguments[e],h=t.split(t.create(r),s),i=0,u=h.length;u>i;i++)n=h[i],this.words.push(n);return this},n.prototype.get=function(){var r,n,e,i;if(arguments.length<1)return this.words.join(s);for(n="",e=0,i=arguments.length;i>e;e++)r=arguments[e],r=h.positiveIndex(r,this.count),r!==!1&&(n+=this.words[r]+s);return t.trim(n)},n.prototype.xs=function(t){var r,n,e,i,s,o,u;if(null==t&&(t=function(){return!0}),!(h.notFunction(t)||this.count<1)){for(e=[],u=this.words,r=s=0,o=u.length;o>s;r=++s)i=u[r],(n=t(i,r))&&(n===!0?e.push(i):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 i.call(this,"upper",Array.prototype.slice.call(arguments)),this},n.prototype.lower=function(){return i.call(this,"lower",Array.prototype.slice.call(arguments)),this},n.prototype.reverse=function(){var r,n,i;if(0===(null!=arguments?arguments[0]:void 0))this.xs(function(r){return t.reverse(r)});else if(arguments.length>0)for(n=0,i=arguments.length;i>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,i,s,o,u;if(null!=r)if(h.isString(r))for(i=0,o=arguments.length;o>i;i++)n=arguments[i],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(s=0,u=arguments.length;u>s;s++)n=arguments[s],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,i,s,f,c;if(arguments.length<1)return this;for(r=[],i=0,f=arguments.length;f>i;i++)t=arguments[i],h.isString(t)?r.unshift(t):h.isNumber(t)&&r.push(n.positiveIndex(t,this.count));for(r=u(o(r)),e=s=0,c=r.length;c>s;e=++s)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,i;for(n=e=0,i=arguments.length;i>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,i,s,o;for(n=arguments[0],i=2<=arguments.length?f.call(arguments,1):[],n=h.positiveIndex(n,this.count),r=s=0,o=i.length;o>s;r=++s)e=i[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 o(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,i,s,o;if(""===(t=h.forceString(t)))return!1;for(i=!0,r=1,t=new n(t),e=s=o=t.count;1>=o?1>=s:s>=1;e=1>=o?++s:--s)t.get(e)!==this.words[this.count-r++]&&(i=!1);return i},n}(r),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:module?module.exports=n:void 0}).call(this);

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