Socket
Socket
Sign inDemoInstall

normalize-space-x

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalize-space-x - npm Package Compare versions

Comparing version 1.3.4 to 2.0.0

3

index.js
/**
* @file Trims and replaces sequences of whitespace characters by a single space.
* @version 1.3.4
* @version 2.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -23,2 +23,3 @@ * @copyright Xotic750

* @param {string} string - The string to be normalized.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The normalized string.

@@ -25,0 +26,0 @@ * @example

(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){
/**
* @file Trims and replaces sequences of whitespace characters by a single space.
* @version 1.3.4
* @version 2.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -24,2 +24,3 @@ * @copyright Xotic750

* @param {string} string - The string to be normalized.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The normalized string.

@@ -35,3 +36,3 @@ * @example

},{"cached-constructors-x":2,"trim-x":7,"white-space-x":8}],2:[function(_dereq_,module,exports){
},{"cached-constructors-x":2,"trim-x":11,"white-space-x":13}],2:[function(_dereq_,module,exports){
/**

@@ -65,4 +66,35 @@ * @file Constructors cached from literals.

},{}],3:[function(_dereq_,module,exports){
/**
* @file Checks if `value` is `null` or `undefined`.
* @version 1.4.1
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module is-nil-x
*/
'use strict';
var isUndefined = _dereq_('validate.io-undefined');
var isNull = _dereq_('lodash.isnull');
/**
* Checks if `value` is `null` or `undefined`.
*
* @param {*} value - The value to check.
* @returns {boolean} Returns `true` if `value` is nullish, else `false`.
* @example
* var isNil = require('is-nil-x');
*
* isNil(null); // => true
* isNil(void 0); // => true
* isNil(NaN); // => false
*/
module.exports = function isNil(value) {
return isNull(value) || isUndefined(value);
};
},{"lodash.isnull":5,"validate.io-undefined":12}],4:[function(_dereq_,module,exports){
'use strict';
var toStr = Object.prototype.toString;

@@ -94,4 +126,110 @@ var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';

},{}],4:[function(_dereq_,module,exports){
},{}],5:[function(_dereq_,module,exports){
/**
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/**
* Checks if `value` is `null`.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
* @example
*
* _.isNull(null);
* // => true
*
* _.isNull(void 0);
* // => false
*/
function isNull(value) {
return value === null;
}
module.exports = isNull;
},{}],6:[function(_dereq_,module,exports){
/**
* @file Requires an argument is corecible then converts using ToString.
* @version 1.0.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module require-coercible-to-string-x
*/
'use strict';
var requireObjectCoercible = _dereq_('require-object-coercible-x');
var toStr = _dereq_('to-string-x');
/**
* This method requires an argument is corecible then converts using ToString.
*
* @param {*} value - The value to converted to a string.
* @throws {TypeError} If value is null or undefined.
* @returns {string} The value as a string.
* @example
* var requireCoercibleToString = require('require-coercible-to-string-x');
*
* requireCoercibleToString(); // TypeError
* requireCoercibleToString(null); // TypeError
* requireCoercibleToString(Symbol('')); // TypeError
* requireCoercibleToString(Object.create(null)); // TypeError
* requireCoercibleToString(1); // '1'
* requireCoercibleToString(true); // 'true'
*/
module.exports = function requireCoercibleToString(value) {
return toStr(requireObjectCoercible(value));
};
},{"require-object-coercible-x":7,"to-string-x":8}],7:[function(_dereq_,module,exports){
/**
* @file ES6-compliant shim for RequireObjectCoercible.
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-requireobjectcoercible|7.2.1 RequireObjectCoercible ( argument )}
* @version 1.4.1
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module require-object-coercible-x
*/
'use strict';
var isNil = _dereq_('is-nil-x');
/**
* The abstract operation RequireObjectCoercible throws an error if argument
* is a value that cannot be converted to an Object using ToObject.
*
* @param {*} value - The `value` to check.
* @throws {TypeError} If `value` is a `null` or `undefined`.
* @returns {string} The `value`.
* @example
* var RequireObjectCoercible = require('require-object-coercible-x');
*
* RequireObjectCoercible(); // TypeError
* RequireObjectCoercible(null); // TypeError
* RequireObjectCoercible('abc'); // 'abc'
* RequireObjectCoercible(true); // true
* RequireObjectCoercible(Symbol('foo')); // Symbol('foo')
*/
module.exports = function RequireObjectCoercible(value) {
if (isNil(value)) {
throw new TypeError('Cannot call method on ' + value);
}
return value;
};
},{"is-nil-x":3}],8:[function(_dereq_,module,exports){
/**
* @file ES6-compliant shim for ToString.

@@ -137,6 +275,6 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tostring|7.1.12 ToString ( argument )}

},{"is-symbol":3}],5:[function(_dereq_,module,exports){
},{"is-symbol":4}],9:[function(_dereq_,module,exports){
/**
* @file This method removes whitespace from the left end of a string.
* @version 1.3.7
* @version 2.0.1
* @author Xotic750 <Xotic750@gmail.com>

@@ -150,3 +288,3 @@ * @copyright Xotic750

var toStr = _dereq_('to-string-x');
var requireCoercibleToString = _dereq_('require-coercible-to-string-x');
var Rx = _dereq_('cached-constructors-x').RegExp;

@@ -160,3 +298,4 @@ var reLeft = new Rx('^[' + _dereq_('white-space-x').string + ']+');

* @param {string} string - The string to trim the left end whitespace from.
* @returns {undefined|string} The left trimmed string.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The left trimmed string.
* @example

@@ -168,9 +307,9 @@ * var trimLeft = require('trim-left-x');

module.exports = function trimLeft(string) {
return replace.call(toStr(string), reLeft, '');
return replace.call(requireCoercibleToString(string), reLeft, '');
};
},{"cached-constructors-x":2,"to-string-x":4,"white-space-x":8}],6:[function(_dereq_,module,exports){
},{"cached-constructors-x":2,"require-coercible-to-string-x":6,"white-space-x":13}],10:[function(_dereq_,module,exports){
/**
* @file This method removes whitespace from the right end of a string.
* @version 1.3.4
* @version 2.0.1
* @author Xotic750 <Xotic750@gmail.com>

@@ -184,3 +323,3 @@ * @copyright Xotic750

var toStr = _dereq_('to-string-x');
var requireCoercibleToString = _dereq_('require-coercible-to-string-x');
var Rx = _dereq_('cached-constructors-x').RegExp;

@@ -194,3 +333,4 @@ var reRight = new Rx('[' + _dereq_('white-space-x').string + ']+$');

* @param {string} string - The string to trim the right end whitespace from.
* @returns {undefined|string} The right trimmed string.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The right trimmed string.
* @example

@@ -202,9 +342,9 @@ * var trimRight = require('trim-right-x');

module.exports = function trimRight(string) {
return replace.call(toStr(string), reRight, '');
return replace.call(requireCoercibleToString(string), reRight, '');
};
},{"cached-constructors-x":2,"to-string-x":4,"white-space-x":8}],7:[function(_dereq_,module,exports){
},{"cached-constructors-x":2,"require-coercible-to-string-x":6,"white-space-x":13}],11:[function(_dereq_,module,exports){
/**
* @file This method removes whitespace from the left and right end of a string.
* @version 1.0.4
* @version 2.0.2
* @author Xotic750 <Xotic750@gmail.com>

@@ -225,3 +365,4 @@ * @copyright Xotic750

* @param {string} string - The string to trim the whitespace from.
* @returns {undefined|string} The trimmed string.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The trimmed string.
* @example

@@ -236,4 +377,51 @@ * var trim = require('trim-x');

},{"trim-left-x":5,"trim-right-x":6}],8:[function(_dereq_,module,exports){
},{"trim-left-x":9,"trim-right-x":10}],12:[function(_dereq_,module,exports){
/**
*
* VALIDATE: undefined
*
*
* DESCRIPTION:
* - Validates if a value is undefined.
*
*
* NOTES:
* [1]
*
*
* TODO:
* [1]
*
*
* LICENSE:
* MIT
*
* Copyright (c) 2014. Athan Reines.
*
*
* AUTHOR:
* Athan Reines. kgryte@gmail.com. 2014.
*
*/
'use strict';
/**
* FUNCTION: isUndefined( value )
* Validates if a value is undefined.
*
* @param {*} value - value to be validated
* @returns {Boolean} boolean indicating whether value is undefined
*/
function isUndefined( value ) {
return value === void 0;
} // end FUNCTION isUndefined()
// EXPORTS //
module.exports = isUndefined;
},{}],13:[function(_dereq_,module,exports){
/**
* @file List of ECMAScript5 white space characters.

@@ -240,0 +428,0 @@ * @version 2.0.3

!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).returnExports=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&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||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){/**
* @file Trims and replaces sequences of whitespace characters by a single space.
* @version 1.3.4
* @version 2.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -9,3 +9,3 @@ * @copyright Xotic750

*/
"use strict";var trim=_dereq_("trim-x"),reNormalize=new(0,_dereq_("cached-constructors-x").RegExp)("["+_dereq_("white-space-x").string+"]+","g"),replace="".replace;module.exports=function normalizeSpace(string){return replace.call(trim(string),reNormalize," ")}},{"cached-constructors-x":2,"trim-x":7,"white-space-x":8}],2:[function(_dereq_,module,exports){/**
"use strict";var trim=_dereq_("trim-x"),reNormalize=new(0,_dereq_("cached-constructors-x").RegExp)("["+_dereq_("white-space-x").string+"]+","g"),replace="".replace;module.exports=function normalizeSpace(string){return replace.call(trim(string),reNormalize," ")}},{"cached-constructors-x":2,"trim-x":11,"white-space-x":13}],2:[function(_dereq_,module,exports){/**
* @file Constructors cached from literals.

@@ -18,3 +18,28 @@ * @version 1.0.0

*/
"use strict";module.exports={Array:[].constructor,Boolean:(!0).constructor,Number:(0).constructor,Object:{}.constructor,RegExp:/(?:)/.constructor,String:"".constructor}},{}],3:[function(_dereq_,module,exports){"use strict";var toStr=Object.prototype.toString;if("function"==typeof Symbol&&"symbol"==typeof Symbol()){var symToStr=Symbol.prototype.toString,symStringRegex=/^Symbol\(.*\)$/,isSymbolObject=function isSymbolObject(value){return"symbol"==typeof value.valueOf()&&symStringRegex.test(symToStr.call(value))};module.exports=function isSymbol(value){if("symbol"==typeof value)return!0;if("[object Symbol]"!==toStr.call(value))return!1;try{return isSymbolObject(value)}catch(e){return!1}}}else module.exports=function isSymbol(value){return!1}},{}],4:[function(_dereq_,module,exports){/**
"use strict";module.exports={Array:[].constructor,Boolean:(!0).constructor,Number:(0).constructor,Object:{}.constructor,RegExp:/(?:)/.constructor,String:"".constructor}},{}],3:[function(_dereq_,module,exports){/**
* @file Checks if `value` is `null` or `undefined`.
* @version 1.4.1
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module is-nil-x
*/
"use strict";var isUndefined=_dereq_("validate.io-undefined"),isNull=_dereq_("lodash.isnull");module.exports=function isNil(value){return isNull(value)||isUndefined(value)}},{"lodash.isnull":5,"validate.io-undefined":12}],4:[function(_dereq_,module,exports){"use strict";var toStr=Object.prototype.toString;if("function"==typeof Symbol&&"symbol"==typeof Symbol()){var symToStr=Symbol.prototype.toString,symStringRegex=/^Symbol\(.*\)$/,isSymbolObject=function isSymbolObject(value){return"symbol"==typeof value.valueOf()&&symStringRegex.test(symToStr.call(value))};module.exports=function isSymbol(value){if("symbol"==typeof value)return!0;if("[object Symbol]"!==toStr.call(value))return!1;try{return isSymbolObject(value)}catch(e){return!1}}}else module.exports=function isSymbol(value){return!1}},{}],5:[function(_dereq_,module,exports){module.exports=function isNull(value){return null===value}},{}],6:[function(_dereq_,module,exports){/**
* @file Requires an argument is corecible then converts using ToString.
* @version 1.0.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module require-coercible-to-string-x
*/
"use strict";var requireObjectCoercible=_dereq_("require-object-coercible-x"),toStr=_dereq_("to-string-x");module.exports=function requireCoercibleToString(value){return toStr(requireObjectCoercible(value))}},{"require-object-coercible-x":7,"to-string-x":8}],7:[function(_dereq_,module,exports){/**
* @file ES6-compliant shim for RequireObjectCoercible.
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-requireobjectcoercible|7.2.1 RequireObjectCoercible ( argument )}
* @version 1.4.1
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module require-object-coercible-x
*/
"use strict";var isNil=_dereq_("is-nil-x");module.exports=function RequireObjectCoercible(value){if(isNil(value))throw new TypeError("Cannot call method on "+value);return value}},{"is-nil-x":3}],8:[function(_dereq_,module,exports){/**
* @file ES6-compliant shim for ToString.

@@ -28,5 +53,5 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tostring|7.1.12 ToString ( argument )}

*/
"use strict";var castString="".constructor,isSymbol=_dereq_("is-symbol");module.exports=function ToString(value){if(isSymbol(value))throw new TypeError("Cannot convert a Symbol value to a string");return castString(value)}},{"is-symbol":3}],5:[function(_dereq_,module,exports){/**
"use strict";var castString="".constructor,isSymbol=_dereq_("is-symbol");module.exports=function ToString(value){if(isSymbol(value))throw new TypeError("Cannot convert a Symbol value to a string");return castString(value)}},{"is-symbol":4}],9:[function(_dereq_,module,exports){/**
* @file This method removes whitespace from the left end of a string.
* @version 1.3.7
* @version 2.0.1
* @author Xotic750 <Xotic750@gmail.com>

@@ -37,5 +62,5 @@ * @copyright Xotic750

*/
"use strict";var toStr=_dereq_("to-string-x"),reLeft=new(0,_dereq_("cached-constructors-x").RegExp)("^["+_dereq_("white-space-x").string+"]+"),replace="".replace;module.exports=function trimLeft(string){return replace.call(toStr(string),reLeft,"")}},{"cached-constructors-x":2,"to-string-x":4,"white-space-x":8}],6:[function(_dereq_,module,exports){/**
"use strict";var requireCoercibleToString=_dereq_("require-coercible-to-string-x"),reLeft=new(0,_dereq_("cached-constructors-x").RegExp)("^["+_dereq_("white-space-x").string+"]+"),replace="".replace;module.exports=function trimLeft(string){return replace.call(requireCoercibleToString(string),reLeft,"")}},{"cached-constructors-x":2,"require-coercible-to-string-x":6,"white-space-x":13}],10:[function(_dereq_,module,exports){/**
* @file This method removes whitespace from the right end of a string.
* @version 1.3.4
* @version 2.0.1
* @author Xotic750 <Xotic750@gmail.com>

@@ -46,5 +71,5 @@ * @copyright Xotic750

*/
"use strict";var toStr=_dereq_("to-string-x"),reRight=new(0,_dereq_("cached-constructors-x").RegExp)("["+_dereq_("white-space-x").string+"]+$"),replace="".replace;module.exports=function trimRight(string){return replace.call(toStr(string),reRight,"")}},{"cached-constructors-x":2,"to-string-x":4,"white-space-x":8}],7:[function(_dereq_,module,exports){/**
"use strict";var requireCoercibleToString=_dereq_("require-coercible-to-string-x"),reRight=new(0,_dereq_("cached-constructors-x").RegExp)("["+_dereq_("white-space-x").string+"]+$"),replace="".replace;module.exports=function trimRight(string){return replace.call(requireCoercibleToString(string),reRight,"")}},{"cached-constructors-x":2,"require-coercible-to-string-x":6,"white-space-x":13}],11:[function(_dereq_,module,exports){/**
* @file This method removes whitespace from the left and right end of a string.
* @version 1.0.4
* @version 2.0.2
* @author Xotic750 <Xotic750@gmail.com>

@@ -55,3 +80,3 @@ * @copyright Xotic750

*/
"use strict";var trimLeft=_dereq_("trim-left-x"),trimRight=_dereq_("trim-right-x");module.exports=function trim(string){return trimLeft(trimRight(string))}},{"trim-left-x":5,"trim-right-x":6}],8:[function(_dereq_,module,exports){/**
"use strict";var trimLeft=_dereq_("trim-left-x"),trimRight=_dereq_("trim-right-x");module.exports=function trim(string){return trimLeft(trimRight(string))}},{"trim-left-x":9,"trim-right-x":10}],12:[function(_dereq_,module,exports){"use strict";module.exports=function isUndefined(value){return void 0===value}},{}],13:[function(_dereq_,module,exports){/**
* @file List of ECMAScript5 white space characters.

@@ -58,0 +83,0 @@ * @version 2.0.3

{
"name": "normalize-space-x",
"version": "1.3.4",
"version": "2.0.0",
"description": "Trims and replaces sequences of whitespace characters by a single space.",

@@ -12,3 +12,3 @@ "homepage": "https://github.com/Xotic750/normalize-space-x",

"keywords": [
"es6",
"string",
"normalize-space",

@@ -34,3 +34,3 @@ "module",

"cached-constructors-x": "^1.0.0",
"trim-x": "^1.0.4",
"trim-x": "^2.0.2",
"white-space-x": "^2.0.3"

@@ -37,0 +37,0 @@ },

@@ -26,3 +26,3 @@ <a href="https://travis-ci.org/Xotic750/normalize-space-x"

**Version**: 1.3.4
**Version**: 2.0.0
**Author**: Xotic750 <Xotic750@gmail.com>

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

**Returns**: <code>string</code> - The normalized string.
**Throws**:
- <code>TypeError</code> If string is null or undefined or not coercible.
| Param | Type | Description |

@@ -43,0 +47,0 @@ | --- | --- | --- |

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