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

white-space-x

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

white-space-x - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

62

index.js

@@ -42,3 +42,3 @@ /**

*
* @version 1.0.1
* @version 1.0.2
* @author Xotic750 <Xotic750@gmail.com>

@@ -55,4 +55,4 @@ * @copyright Xotic750

nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:true, esnext:false, plusplus:true, maxparams:2, maxdepth:4,
maxstatements:17, maxcomplexity:9 */
es3:true, esnext:false, plusplus:true, maxparams:2, maxdepth:2,
maxstatements:6, maxcomplexity:4 */

@@ -64,8 +64,4 @@ /*global module */

var ES = require('es-abstract/es6'),
defProp = require('define-property-x'),
var defProp = require('define-property-x'),
escapeRx = require('regexp.escape'),
aReduce = Array.prototype.reduce,
aIndexOf = Array.prototype.indexOf,
fromCharCode = String.fromCharCode,
whiteSpaces = [

@@ -101,4 +97,23 @@ 0x0009, // Tab

],
cached = {};
c = {
s: whiteSpaces.reduce(function (acc, item) {
return acc + String.fromCharCode(item);
}, ''),
w: (function () {
var count = 65536,
str = '';
do {
count -= 1;
if (whiteSpaces.indexOf(count) < 0) {
str = String.fromCharCode(count) + str;
}
} while (count);
return str;
}())
};
c.se = (c.s + c.w).replace(/\s/g, '') !== c.w ? escapeRx(c.s) : '\\s';
c.we = (c.s + c.w).replace(/\w/g, '') !== c.s ? escapeRx(c.w) : '\\w';
/**

@@ -124,29 +139,6 @@ * Generate a string of ES5 (non-)whitespaces, optionally escaped for use

module.exports = function generateString(nonWhiteSpace, escaped) {
var plain = nonWhiteSpace === true ? 'nws' : 'ws',
esc, count, str;
if (!cached[plain]) {
if (nonWhiteSpace === true) {
count = 65536;
str = '';
do {
count -= 1;
if (ES.Call(aIndexOf, whiteSpaces, [count]) < 0) {
str = fromCharCode(count) + str;
}
} while (count);
} else {
str = ES.Call(aReduce, whiteSpaces, [function (acc, item) {
return acc + fromCharCode(item);
}, '']);
}
cached[plain] = str;
if (nonWhiteSpace === true) {
return escaped === true ? c.we : c.w;
}
if (escaped === true) {
esc = plain + 'e';
if (!cached[esc]) {
cached[esc] = escapeRx(cached[plain]);
}
return cached[esc];
}
return cached[plain];
return escaped === true ? c.se : c.s;
};

@@ -153,0 +145,0 @@

@@ -43,3 +43,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.returnExports = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){

*
* @version 1.0.1
* @version 1.0.2
* @author Xotic750 <Xotic750@gmail.com>

@@ -56,4 +56,4 @@ * @copyright Xotic750

nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:true, esnext:false, plusplus:true, maxparams:2, maxdepth:4,
maxstatements:17, maxcomplexity:9 */
es3:true, esnext:false, plusplus:true, maxparams:2, maxdepth:2,
maxstatements:6, maxcomplexity:4 */

@@ -65,8 +65,4 @@ /*global module */

var ES = _dereq_('es-abstract/es6'),
defProp = _dereq_('define-property-x'),
var defProp = _dereq_('define-property-x'),
escapeRx = _dereq_('regexp.escape'),
aReduce = Array.prototype.reduce,
aIndexOf = Array.prototype.indexOf,
fromCharCode = String.fromCharCode,
whiteSpaces = [

@@ -102,4 +98,23 @@ 0x0009, // Tab

],
cached = {};
c = {
s: whiteSpaces.reduce(function (acc, item) {
return acc + String.fromCharCode(item);
}, ''),
w: (function () {
var count = 65536,
str = '';
do {
count -= 1;
if (whiteSpaces.indexOf(count) < 0) {
str = String.fromCharCode(count) + str;
}
} while (count);
return str;
}())
};
c.se = (c.s + c.w).replace(/\s/g, '') !== c.w ? escapeRx(c.s) : '\\s';
c.we = (c.s + c.w).replace(/\w/g, '') !== c.s ? escapeRx(c.w) : '\\w';
/**

@@ -125,29 +140,6 @@ * Generate a string of ES5 (non-)whitespaces, optionally escaped for use

module.exports = function generateString(nonWhiteSpace, escaped) {
var plain = nonWhiteSpace === true ? 'nws' : 'ws',
esc, count, str;
if (!cached[plain]) {
if (nonWhiteSpace === true) {
count = 65536;
str = '';
do {
count -= 1;
if (ES.Call(aIndexOf, whiteSpaces, [count]) < 0) {
str = fromCharCode(count) + str;
}
} while (count);
} else {
str = ES.Call(aReduce, whiteSpaces, [function (acc, item) {
return acc + fromCharCode(item);
}, '']);
}
cached[plain] = str;
if (nonWhiteSpace === true) {
return escaped === true ? c.we : c.w;
}
if (escaped === true) {
esc = plain + 'e';
if (!cached[esc]) {
cached[esc] = escapeRx(cached[plain]);
}
return cached[esc];
}
return cached[plain];
return escaped === true ? c.se : c.s;
};

@@ -202,3 +194,3 @@

},{"define-property-x":3,"es-abstract/es6":5,"regexp.escape":23}],2:[function(_dereq_,module,exports){
},{"define-property-x":3,"regexp.escape":23}],2:[function(_dereq_,module,exports){
'use strict';

@@ -205,0 +197,0 @@

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

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.returnExports=t()}}(function(){return function e(t,r,n){function s(i,u){if(!r[i]){if(!t[i]){var c="function"==typeof require&&require;if(!u&&c)return c(i,!0);if(o)return o(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var l=r[i]={exports:{}};t[i][0].call(l.exports,function(e){var r=t[i][1][e];return s(r?r:e)},l,l.exports,e,t,r,n)}return r[i].exports}for(var o="function"==typeof require&&require,i=0;i<n.length;i++)s(n[i]);return s}({1:[function(t,e,r){!function(){"use strict";var r=t("es-abstract/es6"),n=t("define-property-x"),o=t("regexp.escape"),i=Array.prototype.reduce,u=Array.prototype.indexOf,c=String.fromCharCode,a=[9,10,11,12,13,32,160,5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288,65279],s={};e.exports=function generateString(t,e){var n,l,f,p=t===!0?"nws":"ws";if(!s[p]){if(t===!0){l=65536,f="";do l-=1,r.Call(u,a,[l])<0&&(f=c(l)+f);while(l)}else f=r.Call(i,a,[function(t,e){return t+c(e)},""]);s[p]=f}return e===!0?(n=p+"e",s[n]||(s[n]=o(s[p])),s[n]):s[p]},n(e.exports,"whiteSpaces",a),n(e.exports,"escape",o)}()},{"define-property-x":3,"es-abstract/es6":5,"regexp.escape":23}],2:[function(t,e,r){"use strict";var n=t("object-keys"),o=t("foreach"),i="function"==typeof Symbol&&"symbol"==typeof Symbol(),u=Object.prototype.toString,c=function(t){return"function"==typeof t&&"[object Function]"===u.call(t)},a=function(){var t={};try{Object.defineProperty(t,"x",{enumerable:!1,value:t});for(var e in t)return!1;return t.x===t}catch(r){return!1}},s=Object.defineProperty&&a(),l=function(t,e,r,n){(!(e in t)||c(n)&&n())&&(s?Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},f=function(t,e){var r=arguments.length>2?arguments[2]:{},u=n(e);i&&(u=u.concat(Object.getOwnPropertySymbols(e))),o(u,function(n){l(t,n,e[n],r[n])})};f.supportsDescriptors=!!s,e.exports=f},{foreach:15,"object-keys":21}],3:[function(t,e,r){!function(){"use strict";function truePredicate(){return!0}var r=t("define-properties");e.exports=function defineProperty(t,e,n,o){var i={},u={};i[e]=n,o&&(u[e]=truePredicate),r(t,i,u)}}()},{"define-properties":2}],4:[function(t,e,r){"use strict";var n=Number.isNaN||function(t){return t!==t},o=t("./helpers/isFinite"),i=t("./helpers/sign"),u=t("./helpers/mod"),c=t("is-callable"),a=t("es-to-primitive/es5"),s={ToPrimitive:a,ToBoolean:function ToBoolean(t){return Boolean(t)},ToNumber:function ToNumber(t){return Number(t)},ToInteger:function ToInteger(t){var e=this.ToNumber(t);return n(e)?0:0!==e&&o(e)?i(e)*Math.floor(Math.abs(e)):e},ToInt32:function ToInt32(t){return this.ToNumber(t)>>0},ToUint32:function ToUint32(t){return this.ToNumber(t)>>>0},ToUint16:function ToUint16(t){var e=this.ToNumber(t);if(n(e)||0===e||!o(e))return 0;var r=i(e)*Math.floor(Math.abs(e));return u(r,65536)},ToString:function ToString(t){return String(t)},ToObject:function ToObject(t){return this.CheckObjectCoercible(t),Object(t)},CheckObjectCoercible:function CheckObjectCoercible(t,e){if(null==t)throw new TypeError(e||"Cannot call method on "+t);return t},IsCallable:c,SameValue:function SameValue(t,e){return t===e?0===t?1/t===1/e:!0:n(t)&&n(e)}};e.exports=s},{"./helpers/isFinite":8,"./helpers/mod":10,"./helpers/sign":11,"es-to-primitive/es5":12,"is-callable":17}],5:[function(t,e,r){"use strict";var n=Object.prototype.toString,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,i=o?Symbol.prototype.toString:n,u=Number.isNaN||function(t){return t!==t},c=t("./helpers/isFinite"),a=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,s=t("./helpers/assign"),l=t("./helpers/sign"),f=t("./helpers/mod"),p=t("./helpers/isPrimitive"),y=t("es-to-primitive/es6"),b=parseInt,m=t("function-bind"),g=m.call(Function.call,String.prototype.slice),h=m.call(Function.call,RegExp.prototype.test,/^0b[01]+$/i),v=m.call(Function.call,RegExp.prototype.test,/^0o[0-7]+$/i),d=["\x85","\u200b","\ufffe"].join(""),S=new RegExp("["+d+"]","g"),j=m.call(Function.call,RegExp.prototype.test,S),T=/^[\-\+]0x[0-9a-f]+$/i,w=m.call(Function.call,RegExp.prototype.test,T),x=[" \n\x0B\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003","\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028","\u2029\ufeff"].join(""),O=new RegExp("(^["+x+"]+)|(["+x+"]+$)","g"),E=m.call(Function.call,String.prototype.replace),N=function(t){return E(t,O,"")},I=t("./es5"),C=t("is-regex"),P=s(s({},I),{Call:function Call(t,e){var r=arguments.length>2?arguments[2]:[];if(!this.IsCallable(t))throw new TypeError(t+" is not a function");return t.apply(e,r)},ToPrimitive:y,ToNumber:function ToNumber(t){var e=p(t)?t:y(t,"number");if("symbol"==typeof e)throw new TypeError("Cannot convert a Symbol value to a number");if("string"==typeof e){if(h(e))return this.ToNumber(b(g(e,2),2));if(v(e))return this.ToNumber(b(g(e,2),8));if(j(e)||w(e))return NaN;var r=N(e);if(r!==e)return this.ToNumber(r)}return Number(e)},ToInt16:function ToInt16(t){var e=this.ToUint16(t);return e>=32768?e-65536:e},ToInt8:function ToInt8(t){var e=this.ToUint8(t);return e>=128?e-256:e},ToUint8:function ToUint8(t){var e=this.ToNumber(t);if(u(e)||0===e||!c(e))return 0;var r=l(e)*Math.floor(Math.abs(e));return f(r,256)},ToUint8Clamp:function ToUint8Clamp(t){var e=this.ToNumber(t);if(u(e)||0>=e)return 0;if(e>=255)return 255;var r=Math.floor(t);return e>r+.5?r+1:r+.5>e?r:r%2!==0?r+1:r},ToString:function ToString(t){if("symbol"==typeof t)throw new TypeError("Cannot convert a Symbol value to a string");return String(t)},ToObject:function ToObject(t){return this.RequireObjectCoercible(t),Object(t)},ToPropertyKey:function ToPropertyKey(t){var e=this.ToPrimitive(t,String);return"symbol"==typeof e?i.call(e):this.ToString(e)},ToLength:function ToLength(t){var e=this.ToInteger(t);return 0>=e?0:e>a?a:e},CanonicalNumericIndexString:function CanonicalNumericIndexString(t){if("[object String]"!==n.call(t))throw new TypeError("must be a string");if("-0"===t)return-0;var e=this.ToNumber(t);return this.SameValue(this.ToString(e),t)?e:void 0},RequireObjectCoercible:I.CheckObjectCoercible,IsArray:Array.isArray||function IsArray(t){return"[object Array]"===n.call(t)},IsConstructor:function IsConstructor(t){return this.IsCallable(t)},IsExtensible:function IsExtensible(t){return Object.preventExtensions?p(t)?!1:Object.isExtensible(t):!0},IsInteger:function IsInteger(t){if("number"!=typeof t||u(t)||!c(t))return!1;var e=Math.abs(t);return Math.floor(e)===e},IsPropertyKey:function IsPropertyKey(t){return"string"==typeof t||"symbol"==typeof t},IsRegExp:function IsRegExp(t){if(!t||"object"!=typeof t)return!1;if(o){var e=RegExp[Symbol.match];if("undefined"!=typeof e)return I.ToBoolean(e)}return C(t)},SameValueZero:function SameValueZero(t,e){return t===e||u(t)&&u(e)}});delete P.CheckObjectCoercible,e.exports=P},{"./es5":4,"./helpers/assign":7,"./helpers/isFinite":8,"./helpers/isPrimitive":9,"./helpers/mod":10,"./helpers/sign":11,"es-to-primitive/es6":13,"function-bind":16,"is-regex":19}],6:[function(t,e,r){"use strict";var n=t("./es6"),o=t("./helpers/assign"),i=o(n,{SameValueNonNumber:function SameValueNonNumber(t,e){if("number"==typeof t||typeof t!=typeof e)throw new TypeError("SameValueNonNumber requires two non-number values of the same type.");return this.SameValue(t,e)}});e.exports=i},{"./es6":5,"./helpers/assign":7}],7:[function(t,e,r){var n=Object.prototype.hasOwnProperty;e.exports=Object.assign||function assign(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);return t}},{}],8:[function(t,e,r){var n=Number.isNaN||function(t){return t!==t};e.exports=Number.isFinite||function(t){return"number"==typeof t&&!n(t)&&t!==1/0&&t!==-(1/0)}},{}],9:[function(t,e,r){e.exports=function isPrimitive(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},{}],10:[function(t,e,r){e.exports=function mod(t,e){var r=t%e;return Math.floor(r>=0?r:r+e)}},{}],11:[function(t,e,r){e.exports=function sign(t){return t>=0?1:-1}},{}],12:[function(t,e,r){"use strict";var n=Object.prototype.toString,o=t("./helpers/isPrimitive"),i=t("is-callable"),u={"[[DefaultValue]]":function(t,e){var r=e||("[object Date]"===n.call(t)?String:Number);if(r===String||r===Number){var u,c,a=r===String?["toString","valueOf"]:["valueOf","toString"];for(c=0;c<a.length;++c)if(i(t[a[c]])&&(u=t[a[c]](),o(u)))return u;throw new TypeError("No default value")}throw new TypeError("invalid [[DefaultValue]] hint supplied")}};e.exports=function ToPrimitive(t,e){return o(t)?t:u["[[DefaultValue]]"](t,e)}},{"./helpers/isPrimitive":14,"is-callable":17}],13:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,o=t("./helpers/isPrimitive"),i=t("is-callable"),u=t("is-date-object"),c=t("is-symbol"),a=function OrdinaryToPrimitive(t,e){if("undefined"==typeof t||null===t)throw new TypeError("Cannot call method on "+t);if("string"!=typeof e||"number"!==e&&"string"!==e)throw new TypeError('hint must be "string" or "number"');var r,n,u,c="string"===e?["toString","valueOf"]:["valueOf","toString"];for(u=0;u<c.length;++u)if(r=t[c[u]],i(r)&&(n=r.call(t),o(n)))return n;throw new TypeError("No default value")},s=function GetMethod(t,e){var r=t[e];if(null!==r&&"undefined"!=typeof r){if(!i(r))throw new TypeError(r+" returned for property "+e+" of object "+t+" is not a function");return r}};e.exports=function ToPrimitive(t,e){if(o(t))return t;var r="default";arguments.length>1&&(e===String?r="string":e===Number&&(r="number"));var i;if(n&&(Symbol.toPrimitive?i=s(t,Symbol.toPrimitive):c(t)&&(i=Symbol.prototype.valueOf)),"undefined"!=typeof i){var l=i.call(t,r);if(o(l))return l;throw new TypeError("unable to convert exotic object to primitive")}return"default"===r&&(u(t)||c(t))&&(r="string"),a(t,"default"===r?"number":r)}},{"./helpers/isPrimitive":14,"is-callable":17,"is-date-object":18,"is-symbol":20}],14:[function(t,e,r){arguments[4][9][0].apply(r,arguments)},{dup:9}],15:[function(t,e,r){var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString;e.exports=function forEach(t,e,r){if("[object Function]"!==o.call(e))throw new TypeError("iterator must be a function");var i=t.length;if(i===+i)for(var u=0;i>u;u++)e.call(r,t[u],u,t);else for(var c in t)n.call(t,c)&&e.call(r,t[c],c,t)}},{}],16:[function(t,e,r){var n="Function.prototype.bind called on incompatible ",o=Array.prototype.slice,i=Object.prototype.toString,u="[object Function]";e.exports=function bind(t){var e=this;if("function"!=typeof e||i.call(e)!==u)throw new TypeError(n+e);for(var r=o.call(arguments,1),c=function(){if(this instanceof f){var n=e.apply(this,r.concat(o.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(o.call(arguments)))},a=Math.max(0,e.length-r.length),s=[],l=0;a>l;l++)s.push("$"+l);var f=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")(c);if(e.prototype){var p=function Empty(){};p.prototype=e.prototype,f.prototype=new p,p.prototype=null}return f}},{}],17:[function(t,e,r){"use strict";var n=/\s*class /,o=function isNonES6ClassFn(t){try{return!n.test(t)}catch(e){return!1}},i=Function.prototype.toString,u=function tryFunctionObject(t){try{return n.test(t)?!1:(i.call(t),!0)}catch(e){return!1}},c=Object.prototype.toString,a="[object Function]",s="[object GeneratorFunction]",l="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function isCallable(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(l)return u(t);if(!o(t))return!1;var e=c.call(t);return e===a||e===s}},{}],18:[function(t,e,r){"use strict";var n=Date.prototype.getDay,o=function tryDateObject(t){try{return n.call(t),!0}catch(e){return!1}},i=Object.prototype.toString,u="[object Date]",c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function isDateObject(t){return"object"!=typeof t||null===t?!1:c?o(t):i.call(t)===u}},{}],19:[function(t,e,r){"use strict";var n=RegExp.prototype.exec,o=function tryRegexExec(t){try{return n.call(t),!0}catch(e){return!1}},i=Object.prototype.toString,u="[object RegExp]",c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function isRegex(t){return"object"!=typeof t?!1:c?o(t):i.call(t)===u}},{}],20:[function(t,e,r){"use strict";var n=Object.prototype.toString,o="function"==typeof Symbol&&"symbol"==typeof Symbol();if(o){var i=Symbol.prototype.toString,u=/^Symbol\(.*\)$/,c=function isSymbolObject(t){return"symbol"!=typeof t.valueOf()?!1:u.test(i.call(t))};e.exports=function isSymbol(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==n.call(t))return!1;try{return c(t)}catch(e){return!1}}}else e.exports=function isSymbol(t){return!1}},{}],21:[function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=Array.prototype.slice,u=t("./isArguments"),c=!{toString:null}.propertyIsEnumerable("toString"),a=function(){}.propertyIsEnumerable("prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},f={$console:!0,$frame:!0,$frameElement:!0,$frames:!0,$parent:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},p=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!f["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{l(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),y=function(t){if("undefined"==typeof window||!p)return l(t);try{return l(t)}catch(e){return!1}},b=function keys(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),i=u(t),l=e&&"[object String]"===o.call(t),f=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=a&&r;if(l&&t.length>0&&!n.call(t,0))for(var b=0;b<t.length;++b)f.push(String(b));if(i&&t.length>0)for(var m=0;m<t.length;++m)f.push(String(m));else for(var g in t)p&&"prototype"===g||!n.call(t,g)||f.push(String(g));if(c)for(var h=y(t),v=0;v<s.length;++v)h&&"constructor"===s[v]||!n.call(t,s[v])||f.push(s[v]);return f};b.shim=function shimObjectKeys(){if(Object.keys){var t=function(){return 2===(Object.keys(arguments)||"").length}(1,2);if(!t){var e=Object.keys;Object.keys=function keys(t){return e(u(t)?i.call(t):t)}}}else Object.keys=b;return Object.keys||b},e.exports=b},{"./isArguments":22}],22:[function(t,e,r){"use strict";var n=Object.prototype.toString;e.exports=function isArguments(t){var e=n.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===n.call(t.callee)),r}},{}],23:[function(t,e,r){"use strict";var n=t("define-properties"),o=t("es-abstract/es7"),i=t("function-bind"),u=i.call(Function.call,String.prototype.replace),c=/[\^\$\\\.\*\+\?\(\)\[\]\{\}\|]/g,a=function escape(t){return u(o.ToString(t),c,"\\$&")};n(a,{method:a,shim:function shimRegExpEscape(){return n(RegExp,{escape:a}),RegExp.escape}}),e.exports=a},{"define-properties":2,"es-abstract/es7":6,"function-bind":16}]},{},[1])(1)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.returnExports=t()}}(function(){return function e(t,r,n){function s(i,u){if(!r[i]){if(!t[i]){var c="function"==typeof require&&require;if(!u&&c)return c(i,!0);if(o)return o(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var l=r[i]={exports:{}};t[i][0].call(l.exports,function(e){var r=t[i][1][e];return s(r?r:e)},l,l.exports,e,t,r,n)}return r[i].exports}for(var o="function"==typeof require&&require,i=0;i<n.length;i++)s(n[i]);return s}({1:[function(t,e,r){!function(){"use strict";var r=t("define-property-x"),n=t("regexp.escape"),o=[9,10,11,12,13,32,160,5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288,65279],i={s:o.reduce(function(t,e){return t+String.fromCharCode(e)},""),w:function(){var t=65536,e="";do t-=1,o.indexOf(t)<0&&(e=String.fromCharCode(t)+e);while(t);return e}()};i.se=(i.s+i.w).replace(/\s/g,"")!==i.w?n(i.s):"\\s",i.we=(i.s+i.w).replace(/\w/g,"")!==i.s?n(i.w):"\\w",e.exports=function generateString(t,e){return t===!0?e===!0?i.we:i.w:e===!0?i.se:i.s},r(e.exports,"whiteSpaces",o),r(e.exports,"escape",n)}()},{"define-property-x":3,"regexp.escape":23}],2:[function(t,e,r){"use strict";var n=t("object-keys"),o=t("foreach"),i="function"==typeof Symbol&&"symbol"==typeof Symbol(),u=Object.prototype.toString,c=function(t){return"function"==typeof t&&"[object Function]"===u.call(t)},a=function(){var t={};try{Object.defineProperty(t,"x",{enumerable:!1,value:t});for(var e in t)return!1;return t.x===t}catch(r){return!1}},s=Object.defineProperty&&a(),l=function(t,e,r,n){(!(e in t)||c(n)&&n())&&(s?Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},f=function(t,e){var r=arguments.length>2?arguments[2]:{},u=n(e);i&&(u=u.concat(Object.getOwnPropertySymbols(e))),o(u,function(n){l(t,n,e[n],r[n])})};f.supportsDescriptors=!!s,e.exports=f},{foreach:15,"object-keys":21}],3:[function(t,e,r){!function(){"use strict";function truePredicate(){return!0}var r=t("define-properties");e.exports=function defineProperty(t,e,n,o){var i={},u={};i[e]=n,o&&(u[e]=truePredicate),r(t,i,u)}}()},{"define-properties":2}],4:[function(t,e,r){"use strict";var n=Number.isNaN||function(t){return t!==t},o=t("./helpers/isFinite"),i=t("./helpers/sign"),u=t("./helpers/mod"),c=t("is-callable"),a=t("es-to-primitive/es5"),s={ToPrimitive:a,ToBoolean:function ToBoolean(t){return Boolean(t)},ToNumber:function ToNumber(t){return Number(t)},ToInteger:function ToInteger(t){var e=this.ToNumber(t);return n(e)?0:0!==e&&o(e)?i(e)*Math.floor(Math.abs(e)):e},ToInt32:function ToInt32(t){return this.ToNumber(t)>>0},ToUint32:function ToUint32(t){return this.ToNumber(t)>>>0},ToUint16:function ToUint16(t){var e=this.ToNumber(t);if(n(e)||0===e||!o(e))return 0;var r=i(e)*Math.floor(Math.abs(e));return u(r,65536)},ToString:function ToString(t){return String(t)},ToObject:function ToObject(t){return this.CheckObjectCoercible(t),Object(t)},CheckObjectCoercible:function CheckObjectCoercible(t,e){if(null==t)throw new TypeError(e||"Cannot call method on "+t);return t},IsCallable:c,SameValue:function SameValue(t,e){return t===e?0===t?1/t===1/e:!0:n(t)&&n(e)}};e.exports=s},{"./helpers/isFinite":8,"./helpers/mod":10,"./helpers/sign":11,"es-to-primitive/es5":12,"is-callable":17}],5:[function(t,e,r){"use strict";var n=Object.prototype.toString,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,i=o?Symbol.prototype.toString:n,u=Number.isNaN||function(t){return t!==t},c=t("./helpers/isFinite"),a=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,s=t("./helpers/assign"),l=t("./helpers/sign"),f=t("./helpers/mod"),p=t("./helpers/isPrimitive"),y=t("es-to-primitive/es6"),b=parseInt,m=t("function-bind"),g=m.call(Function.call,String.prototype.slice),h=m.call(Function.call,RegExp.prototype.test,/^0b[01]+$/i),v=m.call(Function.call,RegExp.prototype.test,/^0o[0-7]+$/i),d=["\x85","\u200b","\ufffe"].join(""),S=new RegExp("["+d+"]","g"),j=m.call(Function.call,RegExp.prototype.test,S),w=/^[\-\+]0x[0-9a-f]+$/i,T=m.call(Function.call,RegExp.prototype.test,w),x=[" \n\x0B\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003","\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028","\u2029\ufeff"].join(""),O=new RegExp("(^["+x+"]+)|(["+x+"]+$)","g"),E=m.call(Function.call,String.prototype.replace),N=function(t){return E(t,O,"")},I=t("./es5"),C=t("is-regex"),P=s(s({},I),{Call:function Call(t,e){var r=arguments.length>2?arguments[2]:[];if(!this.IsCallable(t))throw new TypeError(t+" is not a function");return t.apply(e,r)},ToPrimitive:y,ToNumber:function ToNumber(t){var e=p(t)?t:y(t,"number");if("symbol"==typeof e)throw new TypeError("Cannot convert a Symbol value to a number");if("string"==typeof e){if(h(e))return this.ToNumber(b(g(e,2),2));if(v(e))return this.ToNumber(b(g(e,2),8));if(j(e)||T(e))return NaN;var r=N(e);if(r!==e)return this.ToNumber(r)}return Number(e)},ToInt16:function ToInt16(t){var e=this.ToUint16(t);return e>=32768?e-65536:e},ToInt8:function ToInt8(t){var e=this.ToUint8(t);return e>=128?e-256:e},ToUint8:function ToUint8(t){var e=this.ToNumber(t);if(u(e)||0===e||!c(e))return 0;var r=l(e)*Math.floor(Math.abs(e));return f(r,256)},ToUint8Clamp:function ToUint8Clamp(t){var e=this.ToNumber(t);if(u(e)||0>=e)return 0;if(e>=255)return 255;var r=Math.floor(t);return e>r+.5?r+1:r+.5>e?r:r%2!==0?r+1:r},ToString:function ToString(t){if("symbol"==typeof t)throw new TypeError("Cannot convert a Symbol value to a string");return String(t)},ToObject:function ToObject(t){return this.RequireObjectCoercible(t),Object(t)},ToPropertyKey:function ToPropertyKey(t){var e=this.ToPrimitive(t,String);return"symbol"==typeof e?i.call(e):this.ToString(e)},ToLength:function ToLength(t){var e=this.ToInteger(t);return 0>=e?0:e>a?a:e},CanonicalNumericIndexString:function CanonicalNumericIndexString(t){if("[object String]"!==n.call(t))throw new TypeError("must be a string");if("-0"===t)return-0;var e=this.ToNumber(t);return this.SameValue(this.ToString(e),t)?e:void 0},RequireObjectCoercible:I.CheckObjectCoercible,IsArray:Array.isArray||function IsArray(t){return"[object Array]"===n.call(t)},IsConstructor:function IsConstructor(t){return this.IsCallable(t)},IsExtensible:function IsExtensible(t){return Object.preventExtensions?p(t)?!1:Object.isExtensible(t):!0},IsInteger:function IsInteger(t){if("number"!=typeof t||u(t)||!c(t))return!1;var e=Math.abs(t);return Math.floor(e)===e},IsPropertyKey:function IsPropertyKey(t){return"string"==typeof t||"symbol"==typeof t},IsRegExp:function IsRegExp(t){if(!t||"object"!=typeof t)return!1;if(o){var e=RegExp[Symbol.match];if("undefined"!=typeof e)return I.ToBoolean(e)}return C(t)},SameValueZero:function SameValueZero(t,e){return t===e||u(t)&&u(e)}});delete P.CheckObjectCoercible,e.exports=P},{"./es5":4,"./helpers/assign":7,"./helpers/isFinite":8,"./helpers/isPrimitive":9,"./helpers/mod":10,"./helpers/sign":11,"es-to-primitive/es6":13,"function-bind":16,"is-regex":19}],6:[function(t,e,r){"use strict";var n=t("./es6"),o=t("./helpers/assign"),i=o(n,{SameValueNonNumber:function SameValueNonNumber(t,e){if("number"==typeof t||typeof t!=typeof e)throw new TypeError("SameValueNonNumber requires two non-number values of the same type.");return this.SameValue(t,e)}});e.exports=i},{"./es6":5,"./helpers/assign":7}],7:[function(t,e,r){var n=Object.prototype.hasOwnProperty;e.exports=Object.assign||function assign(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);return t}},{}],8:[function(t,e,r){var n=Number.isNaN||function(t){return t!==t};e.exports=Number.isFinite||function(t){return"number"==typeof t&&!n(t)&&t!==1/0&&t!==-(1/0)}},{}],9:[function(t,e,r){e.exports=function isPrimitive(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},{}],10:[function(t,e,r){e.exports=function mod(t,e){var r=t%e;return Math.floor(r>=0?r:r+e)}},{}],11:[function(t,e,r){e.exports=function sign(t){return t>=0?1:-1}},{}],12:[function(t,e,r){"use strict";var n=Object.prototype.toString,o=t("./helpers/isPrimitive"),i=t("is-callable"),u={"[[DefaultValue]]":function(t,e){var r=e||("[object Date]"===n.call(t)?String:Number);if(r===String||r===Number){var u,c,a=r===String?["toString","valueOf"]:["valueOf","toString"];for(c=0;c<a.length;++c)if(i(t[a[c]])&&(u=t[a[c]](),o(u)))return u;throw new TypeError("No default value")}throw new TypeError("invalid [[DefaultValue]] hint supplied")}};e.exports=function ToPrimitive(t,e){return o(t)?t:u["[[DefaultValue]]"](t,e)}},{"./helpers/isPrimitive":14,"is-callable":17}],13:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,o=t("./helpers/isPrimitive"),i=t("is-callable"),u=t("is-date-object"),c=t("is-symbol"),a=function OrdinaryToPrimitive(t,e){if("undefined"==typeof t||null===t)throw new TypeError("Cannot call method on "+t);if("string"!=typeof e||"number"!==e&&"string"!==e)throw new TypeError('hint must be "string" or "number"');var r,n,u,c="string"===e?["toString","valueOf"]:["valueOf","toString"];for(u=0;u<c.length;++u)if(r=t[c[u]],i(r)&&(n=r.call(t),o(n)))return n;throw new TypeError("No default value")},s=function GetMethod(t,e){var r=t[e];if(null!==r&&"undefined"!=typeof r){if(!i(r))throw new TypeError(r+" returned for property "+e+" of object "+t+" is not a function");return r}};e.exports=function ToPrimitive(t,e){if(o(t))return t;var r="default";arguments.length>1&&(e===String?r="string":e===Number&&(r="number"));var i;if(n&&(Symbol.toPrimitive?i=s(t,Symbol.toPrimitive):c(t)&&(i=Symbol.prototype.valueOf)),"undefined"!=typeof i){var l=i.call(t,r);if(o(l))return l;throw new TypeError("unable to convert exotic object to primitive")}return"default"===r&&(u(t)||c(t))&&(r="string"),a(t,"default"===r?"number":r)}},{"./helpers/isPrimitive":14,"is-callable":17,"is-date-object":18,"is-symbol":20}],14:[function(t,e,r){arguments[4][9][0].apply(r,arguments)},{dup:9}],15:[function(t,e,r){var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString;e.exports=function forEach(t,e,r){if("[object Function]"!==o.call(e))throw new TypeError("iterator must be a function");var i=t.length;if(i===+i)for(var u=0;i>u;u++)e.call(r,t[u],u,t);else for(var c in t)n.call(t,c)&&e.call(r,t[c],c,t)}},{}],16:[function(t,e,r){var n="Function.prototype.bind called on incompatible ",o=Array.prototype.slice,i=Object.prototype.toString,u="[object Function]";e.exports=function bind(t){var e=this;if("function"!=typeof e||i.call(e)!==u)throw new TypeError(n+e);for(var r=o.call(arguments,1),c=function(){if(this instanceof f){var n=e.apply(this,r.concat(o.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(o.call(arguments)))},a=Math.max(0,e.length-r.length),s=[],l=0;a>l;l++)s.push("$"+l);var f=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")(c);if(e.prototype){var p=function Empty(){};p.prototype=e.prototype,f.prototype=new p,p.prototype=null}return f}},{}],17:[function(t,e,r){"use strict";var n=/\s*class /,o=function isNonES6ClassFn(t){try{return!n.test(t)}catch(e){return!1}},i=Function.prototype.toString,u=function tryFunctionObject(t){try{return n.test(t)?!1:(i.call(t),!0)}catch(e){return!1}},c=Object.prototype.toString,a="[object Function]",s="[object GeneratorFunction]",l="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function isCallable(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(l)return u(t);if(!o(t))return!1;var e=c.call(t);return e===a||e===s}},{}],18:[function(t,e,r){"use strict";var n=Date.prototype.getDay,o=function tryDateObject(t){try{return n.call(t),!0}catch(e){return!1}},i=Object.prototype.toString,u="[object Date]",c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function isDateObject(t){return"object"!=typeof t||null===t?!1:c?o(t):i.call(t)===u}},{}],19:[function(t,e,r){"use strict";var n=RegExp.prototype.exec,o=function tryRegexExec(t){try{return n.call(t),!0}catch(e){return!1}},i=Object.prototype.toString,u="[object RegExp]",c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function isRegex(t){return"object"!=typeof t?!1:c?o(t):i.call(t)===u}},{}],20:[function(t,e,r){"use strict";var n=Object.prototype.toString,o="function"==typeof Symbol&&"symbol"==typeof Symbol();if(o){var i=Symbol.prototype.toString,u=/^Symbol\(.*\)$/,c=function isSymbolObject(t){return"symbol"!=typeof t.valueOf()?!1:u.test(i.call(t))};e.exports=function isSymbol(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==n.call(t))return!1;try{return c(t)}catch(e){return!1}}}else e.exports=function isSymbol(t){return!1}},{}],21:[function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=Array.prototype.slice,u=t("./isArguments"),c=!{toString:null}.propertyIsEnumerable("toString"),a=function(){}.propertyIsEnumerable("prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},f={$console:!0,$frame:!0,$frameElement:!0,$frames:!0,$parent:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},p=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!f["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{l(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),y=function(t){if("undefined"==typeof window||!p)return l(t);try{return l(t)}catch(e){return!1}},b=function keys(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),i=u(t),l=e&&"[object String]"===o.call(t),f=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=a&&r;if(l&&t.length>0&&!n.call(t,0))for(var b=0;b<t.length;++b)f.push(String(b));if(i&&t.length>0)for(var m=0;m<t.length;++m)f.push(String(m));else for(var g in t)p&&"prototype"===g||!n.call(t,g)||f.push(String(g));if(c)for(var h=y(t),v=0;v<s.length;++v)h&&"constructor"===s[v]||!n.call(t,s[v])||f.push(s[v]);return f};b.shim=function shimObjectKeys(){if(Object.keys){var t=function(){return 2===(Object.keys(arguments)||"").length}(1,2);if(!t){var e=Object.keys;Object.keys=function keys(t){return e(u(t)?i.call(t):t)}}}else Object.keys=b;return Object.keys||b},e.exports=b},{"./isArguments":22}],22:[function(t,e,r){"use strict";var n=Object.prototype.toString;e.exports=function isArguments(t){var e=n.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===n.call(t.callee)),r}},{}],23:[function(t,e,r){"use strict";var n=t("define-properties"),o=t("es-abstract/es7"),i=t("function-bind"),u=i.call(Function.call,String.prototype.replace),c=/[\^\$\\\.\*\+\?\(\)\[\]\{\}\|]/g,a=function escape(t){return u(o.ToString(t),c,"\\$&")};n(a,{method:a,shim:function shimRegExpEscape(){return n(RegExp,{escape:a}),RegExp.escape}}),e.exports=a},{"define-properties":2,"es-abstract/es7":6,"function-bind":16}]},{},[1])(1)});
//# sourceMappingURL=lib/white-space-x.map
{
"name": "white-space-x",
"version": "1.0.1",
"version": "1.0.2",
"description": "whitespace module.",

@@ -14,2 +14,3 @@ "homepage": "https://github.com/Xotic750/white-space-x",

"whitespaces",
"RegExp",
"module",

@@ -33,3 +34,2 @@ "javascript",

"dependencies": {
"es-abstract": "^1.5.0",
"define-property-x": "^1.0.6",

@@ -36,0 +36,0 @@ "regexp.escape": "^1.0.2"

@@ -42,3 +42,3 @@ <a name="module_white-space-x"></a>

**Version**: 1.0.1
**Version**: 1.0.2
**Author:** Xotic750 <Xotic750@gmail.com>

@@ -45,0 +45,0 @@ **License**: [MIT](&lt;https://opensource.org/licenses/MIT&gt;)

@@ -6,4 +6,4 @@ /*jslint maxlen:80, es6:false, white:true */

nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:true, esnext:false, plusplus:true, maxparams:2, maxdepth:2,
maxstatements:18, maxcomplexity:3 */
es3:true, esnext:false, plusplus:true, maxparams:2, maxdepth:3,
maxstatements:13, maxcomplexity:3 */

@@ -72,7 +72,18 @@ /*global JSON:true, expect, module, require, describe, it, returnExports */

it('should be not equal', function () {
expect(generateString(true)).not.toBe(ws);
expect(generateString(true)).not.toBe(generateString());
it('should be equal', function () {
var re = new RegExp('[' + generateString() + ']', 'g');
expect((generateString() + generateString(true)).replace(re, ''))
.toEqual(generateString(true));
expect((generateString(true) + generateString()).replace(re, ''))
.toEqual(generateString(true));
});
it('should be equal', function () {
var re = new RegExp('[' + generateString(true, true) + ']', 'g');
expect((generateString() + generateString(true)).replace(re, ''))
.toEqual(generateString());
expect((generateString(true) + generateString()).replace(re, ''))
.toEqual(generateString());
});
it('should be `true`', function () {

@@ -79,0 +90,0 @@ var re = new RegExp('^[' + generateString(false, true) + ']+$');

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