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

trim-x

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trim-x - npm Package Compare versions

Comparing version 2.0.2 to 3.0.0

63

index.js
/**
* @file This method removes whitespace from the left and right end of a string.
* @version 2.0.2
* @version 3.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -12,18 +12,49 @@ * @copyright Xotic750

var trimLeft = require('trim-left-x');
var trimRight = require('trim-right-x');
var libTrimLeft = require('trim-left-x');
var trimLeft2016 = libTrimLeft.trimLeft2016;
var trimLeft2018 = libTrimLeft.trimLeft2018;
var libTrimRight = require('trim-right-x');
var trimRight2016 = libTrimRight.trimRight2016;
var trimRight2018 = libTrimRight.trimRight2016;
/**
* This method removes whitespace from the left and right end of a string.
*
* @param {string} string - The string to trim the whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The trimmed string.
* @example
* var trim = require('trim-x');
*
* trim(' \t\na \t\n') === 'a'; // true
*/
module.exports = function trim(string) {
return trimLeft(trimRight(string));
var $trim2016 = function trim2016(string) {
return trimLeft2016(trimRight2016(string));
};
var $trim2018 = function trim2018(string) {
return trimLeft2018(trimRight2018(string));
};
module.exports = {
/**
* A reference to trim2018.
*/
trim: $trim2018,
/**
* This method removes whitespace from the left and right end of a string.
* (ES2016)
* @param {string} string - The string to trim the whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The trimmed string.
* @example
* var trim = require('trim-x');
*
* trim(' \t\na \t\n') === 'a'; // true
*/
trim2016: $trim2016,
/**
* This method removes whitespace from the left and right end of a string.
* (ES2018)
*
* @param {string} string - The string to trim the whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The trimmed string.
* @example
* var trim = require('trim-x');
*
* trim(' \t\na \t\n') === 'a'; // true
*/
trim2018: $trim2018
};
(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 This method removes whitespace from the left and right end of a string.
* @version 2.0.2
* @version 3.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -13,20 +13,51 @@ * @copyright Xotic750

var trimLeft = _dereq_('trim-left-x');
var trimRight = _dereq_('trim-right-x');
var libTrimLeft = _dereq_('trim-left-x');
var trimLeft2016 = libTrimLeft.trimLeft2016;
var trimLeft2018 = libTrimLeft.trimLeft2018;
var libTrimRight = _dereq_('trim-right-x');
var trimRight2016 = libTrimRight.trimRight2016;
var trimRight2018 = libTrimRight.trimRight2016;
/**
* This method removes whitespace from the left and right end of a string.
*
* @param {string} string - The string to trim the whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The trimmed string.
* @example
* var trim = require('trim-x');
*
* trim(' \t\na \t\n') === 'a'; // true
*/
module.exports = function trim(string) {
return trimLeft(trimRight(string));
var $trim2016 = function trim2016(string) {
return trimLeft2016(trimRight2016(string));
};
var $trim2018 = function trim2018(string) {
return trimLeft2018(trimRight2018(string));
};
module.exports = {
/**
* A reference to trim2018.
*/
trim: $trim2018,
/**
* This method removes whitespace from the left and right end of a string.
* (ES2016)
* @param {string} string - The string to trim the whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The trimmed string.
* @example
* var trim = require('trim-x');
*
* trim(' \t\na \t\n') === 'a'; // true
*/
trim2016: $trim2016,
/**
* This method removes whitespace from the left and right end of a string.
* (ES2018)
*
* @param {string} string - The string to trim the whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The trimmed string.
* @example
* var trim = require('trim-x');
*
* trim(' \t\na \t\n') === 'a'; // true
*/
trim2018: $trim2018
};
},{"trim-left-x":9,"trim-right-x":10}],2:[function(_dereq_,module,exports){

@@ -271,3 +302,3 @@ /**

* @file This method removes whitespace from the left end of a string.
* @version 2.0.1
* @version 3.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -283,24 +314,51 @@ * @copyright Xotic750

var Rx = _dereq_('cached-constructors-x').RegExp;
var reLeft = new Rx('^[' + _dereq_('white-space-x').string + ']+');
var reLeft2016 = new Rx('^[' + _dereq_('white-space-x').string2016 + ']+');
var reLeft2018 = new Rx('^[' + _dereq_('white-space-x').string2018 + ']+');
var replace = ''.replace;
/**
* This method removes whitespace from the left end of a string.
*
* @param {string} string - The string to trim the left end whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The left trimmed string.
* @example
* var trimLeft = require('trim-left-x');
*
* trimLeft(' \t\na \t\n') === 'a \t\n'; // true
*/
module.exports = function trimLeft(string) {
return replace.call(requireCoercibleToString(string), reLeft, '');
var $trimLeft2016 = function trimLeft2016(string) {
return replace.call(requireCoercibleToString(string), reLeft2016, '');
};
var $trimLeft2018 = function trimLeft2018(string) {
return replace.call(requireCoercibleToString(string), reLeft2018, '');
};
module.exports = {
/**
* A reference to leftTrim2018.
*/
trimLeft: $trimLeft2018,
/**
* This method removes whitespace from the left end of a string. (ES2016)
*
* @param {string} string - The string to trim the left end whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The left trimmed string.
* @example
* var trimLeft = require('trim-left-x').trimLeft2016;
*
* trimLeft(' \t\na \t\n') === 'a \t\n'; // true
*/
trimLeft2016: $trimLeft2016,
/**
* This method removes whitespace from the left end of a string. (ES2018)
*
* @param {string} string - The string to trim the left end whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The left trimmed string.
* @example
* var trimLeft = require('trim-left-x').trimLeft2018;
*
* trimLeft(' \t\na \t\n') === 'a \t\n'; // true
*/
trimLeft2018: $trimLeft2018
};
},{"cached-constructors-x":2,"require-coercible-to-string-x":6,"white-space-x":12}],10:[function(_dereq_,module,exports){
/**
* @file This method removes whitespace from the right end of a string.
* @version 2.0.1
* @version 3.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -316,20 +374,47 @@ * @copyright Xotic750

var Rx = _dereq_('cached-constructors-x').RegExp;
var reRight = new Rx('[' + _dereq_('white-space-x').string + ']+$');
var reRight2016 = new Rx('[' + _dereq_('white-space-x').string2016 + ']+$');
var reRight2018 = new Rx('[' + _dereq_('white-space-x').string2018 + ']+$');
var replace = ''.replace;
/**
* This method removes whitespace from the right end of a string.
*
* @param {string} string - The string to trim the right end whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The right trimmed string.
* @example
* var trimRight = require('trim-right-x');
*
* trimRight(' \t\na \t\n') === ' \t\na'; // true
*/
module.exports = function trimRight(string) {
return replace.call(requireCoercibleToString(string), reRight, '');
var $trimRight2016 = function trimRight2016(string) {
return replace.call(requireCoercibleToString(string), reRight2016, '');
};
var $trimRight2018 = function trimRight2018(string) {
return replace.call(requireCoercibleToString(string), reRight2018, '');
};
module.exports = {
/**
* A reference to trimRight2018.
*/
trimRight: $trimRight2018,
/**
* This method removes whitespace from the right end of a string. (ES2016)
*
* @param {string} string - The string to trim the right end whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The right trimmed string.
* @example
* var trimRight = require('trim-right-x');
*
* trimRight(' \t\na \t\n') === ' \t\na'; // true
*/
trimRight2016: $trimRight2016,
/**
* This method removes whitespace from the right end of a string. (ES2018)
*
* @param {string} string - The string to trim the right end whitespace from.
* @throws {TypeError} If string is null or undefined or not coercible.
* @returns {string} The right trimmed string.
* @example
* var trimRight = require('trim-right-x');
*
* trimRight(' \t\na \t\n') === ' \t\na'; // true
*/
trimRight2018: $trimRight2018
};
},{"cached-constructors-x":2,"require-coercible-to-string-x":6,"white-space-x":12}],11:[function(_dereq_,module,exports){

@@ -384,4 +469,4 @@ /**

/**
* @file List of ECMAScript5 white space characters.
* @version 2.0.3
* @file List of ECMAScript white space characters.
* @version 3.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -396,12 +481,22 @@ * @copyright Xotic750

/**
* An array of the ES5 whitespace char codes, string, and their descriptions.
* A record of a white space character.
*
* @name list
* @type Array.<Object>
* @example
* var whiteSpace = require('white-space-x');
* whiteSpaces.list.foreach(function (item) {
* console.log(lib.description, item.code, item.string);
* });
* @typedef {Object} CharRecord
* @property {number} code - The character code.
* @property {string} description - A description of the character.
* @property {boolean} es5 - Whether the spec lists this as a white space.
* @property {boolean} es2015 - Whether the spec lists this as a white space.
* @property {boolean} es2016 - Whether the spec lists this as a white space.
* @property {boolean} es2017 - Whether the spec lists this as a white space.
* @property {boolean} es2018 - Whether the spec lists this as a white space.
* @property {string} string - The character string.
*/
/**
* An array of the whitespace char codes, string, descriptions and language
* presence in the specifications.
*
* @private
* @type Array.<CharRecord>
*/
var list = [

@@ -411,2 +506,7 @@ {

description: 'Tab',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u0009'

@@ -417,2 +517,7 @@ },

description: 'Line Feed',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u000a'

@@ -423,2 +528,7 @@ },

description: 'Vertical Tab',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u000b'

@@ -429,2 +539,7 @@ },

description: 'Form Feed',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u000c'

@@ -435,2 +550,7 @@ },

description: 'Carriage Return',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u000d'

@@ -441,2 +561,7 @@ },

description: 'Space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u0020'

@@ -447,3 +572,8 @@ },

code: 0x0085,
description: 'Next line - Not ES5 whitespace',
description: 'Next line',
es5: false,
es2015: false,
es2016: false,
es2017: false,
es2018: false,
string: '\u0085'

@@ -455,2 +585,7 @@ }

description: 'No-break space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u00a0'

@@ -461,2 +596,7 @@ },

description: 'Ogham space mark',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u1680'

@@ -467,2 +607,7 @@ },

description: 'Mongolian vowel separator',
es5: true,
es2015: true,
es2016: true,
es2017: false,
es2018: false,
string: '\u180e'

@@ -473,2 +618,7 @@ },

description: 'En quad',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2000'

@@ -479,2 +629,7 @@ },

description: 'Em quad',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2001'

@@ -485,2 +640,7 @@ },

description: 'En space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2002'

@@ -491,2 +651,7 @@ },

description: 'Em space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2003'

@@ -497,2 +662,7 @@ },

description: 'Three-per-em space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2004'

@@ -503,2 +673,7 @@ },

description: 'Four-per-em space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2005'

@@ -509,2 +684,7 @@ },

description: 'Six-per-em space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2006'

@@ -515,2 +695,7 @@ },

description: 'Figure space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2007'

@@ -521,2 +706,7 @@ },

description: 'Punctuation space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2008'

@@ -527,2 +717,7 @@ },

description: 'Thin space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2009'

@@ -533,2 +728,7 @@ },

description: 'Hair space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u200a'

@@ -539,3 +739,8 @@ },

code: 0x200b,
description: 'Zero width space - Not ES5 whitespace',
description: 'Zero width space',
es5: false,
es2015: false,
es2016: false,
es2017: false,
es2018: false,
string: '\u200b'

@@ -547,2 +752,7 @@ },

description: 'Line separator',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2028'

@@ -553,2 +763,7 @@ },

description: 'Paragraph separator',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u2029'

@@ -559,2 +774,7 @@ },

description: 'Narrow no-break space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u202f'

@@ -565,2 +785,7 @@ },

description: 'Medium mathematical space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u205f'

@@ -571,2 +796,7 @@ },

description: 'Ideographic space',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\u3000'

@@ -577,2 +807,7 @@ },

description: 'Byte Order Mark',
es5: true,
es2015: true,
es2016: true,
es2017: true,
es2018: true,
string: '\ufeff'

@@ -582,50 +817,134 @@ }

var string = '';
var stringES2016 = '';
var stringES2018 = '';
var length = list.length;
for (var i = 0; i < length; i += 1) {
string += list[i].string;
if (list[i].es2016) {
stringES2016 += list[i].string;
}
if (list[i].es2018) {
stringES2018 += list[i].string;
}
}
/**
* A string of the ES5 whitespace characters.
*
* @name string
* @type string
* @example
* var whiteSpace = require('white-space-x');
* var characters = [
* '\u0009',
* '\u000a',
* '\u000b',
* '\u000c',
* '\u000d',
* '\u0020',
* '\u00a0',
* '\u1680',
* '\u180e',
* '\u2000',
* '\u2001',
* '\u2002',
* '\u2003',
* '\u2004',
* '\u2005',
* '\u2006',
* '\u2007',
* '\u2008',
* '\u2009',
* '\u200a',
* '\u2028',
* '\u2029',
* '\u202f',
* '\u205f',
* '\u3000',
* '\ufeff'
* ];
* var ws = characters.join('');
* var re1 = new RegExp('^[' + whiteSpace.string + ']+$)');
* re1.test(ws); // true
*/
module.exports = {
/**
* An array of the whitespace char codes, string, descriptions and language
* presence in the specifications.
*
* @type Array.<CharRecord>
* @example
* var whiteSpace = require('white-space-x');
* whiteSpaces.list.foreach(function (item) {
* console.log(lib.description, item.code, item.string);
* });
*/
list: list,
string: string
/**
* A string of the ES2017 to ES2018 whitespace characters.
*
* @type string
*/
string: stringES2018,
/**
* A string of the ES5 to ES2016 whitespace characters.
*
* @type string
*/
string5: stringES2016,
/**
* A string of the ES5 to ES2016 whitespace characters.
*
* @type string
*/
string2015: stringES2016,
/**
* A string of the ES5 to ES2016 whitespace characters.
*
* @type string
* @example
* var whiteSpace = require('white-space-x');
* var characters = [
* '\u0009',
* '\u000a',
* '\u000b',
* '\u000c',
* '\u000d',
* '\u0020',
* '\u00a0',
* '\u1680',
* '\u180e',
* '\u2000',
* '\u2001',
* '\u2002',
* '\u2003',
* '\u2004',
* '\u2005',
* '\u2006',
* '\u2007',
* '\u2008',
* '\u2009',
* '\u200a',
* '\u2028',
* '\u2029',
* '\u202f',
* '\u205f',
* '\u3000',
* '\ufeff'
* ];
* var ws = characters.join('');
* var re1 = new RegExp('^[' + whiteSpace.string2016 + ']+$)');
* re1.test(ws); // true
*/
string2016: stringES2016,
/**
* A string of the ES2017 to ES2018 whitespace characters.
*
* @type string
*/
string2017: stringES2018,
/**
* A string of the ES2017 to ES2018 whitespace characters.
*
* @type string
* @example
* var whiteSpace = require('white-space-x');
* var characters = [
* '\u0009',
* '\u000a',
* '\u000b',
* '\u000c',
* '\u000d',
* '\u0020',
* '\u00a0',
* '\u1680',
* '\u2000',
* '\u2001',
* '\u2002',
* '\u2003',
* '\u2004',
* '\u2005',
* '\u2006',
* '\u2007',
* '\u2008',
* '\u2009',
* '\u200a',
* '\u2028',
* '\u2029',
* '\u202f',
* '\u205f',
* '\u3000',
* '\ufeff'
* ];
* var ws = characters.join('');
* var re1 = new RegExp('^[' + whiteSpace.string2018 + ']+$)');
* re1.test(ws); // true
*/
string2018: stringES2018
};

@@ -632,0 +951,0 @@

!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 This method removes whitespace from the left and right end of a string.
* @version 2.0.2
* @version 3.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -9,3 +9,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":9,"trim-right-x":10}],2:[function(_dereq_,module,exports){/**
"use strict";var libTrimLeft=_dereq_("trim-left-x"),trimLeft2016=libTrimLeft.trimLeft2016,trimLeft2018=libTrimLeft.trimLeft2018,libTrimRight=_dereq_("trim-right-x"),trimRight2016=libTrimRight.trimRight2016,trimRight2018=libTrimRight.trimRight2016,$trim2018=function trim2018(string){return trimLeft2018(trimRight2018(string))};module.exports={trim:$trim2018,trim2016:function trim2016(string){return trimLeft2016(trimRight2016(string))},trim2018:$trim2018}},{"trim-left-x":9,"trim-right-x":10}],2:[function(_dereq_,module,exports){/**
* @file Constructors cached from literals.

@@ -54,3 +54,3 @@ * @version 1.0.0

* @file This method removes whitespace from the left end of a string.
* @version 2.0.1
* @version 3.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -61,5 +61,5 @@ * @copyright Xotic750

*/
"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":12}],10:[function(_dereq_,module,exports){/**
"use strict";var requireCoercibleToString=_dereq_("require-coercible-to-string-x"),Rx=_dereq_("cached-constructors-x").RegExp,reLeft2016=new Rx("^["+_dereq_("white-space-x").string2016+"]+"),reLeft2018=new Rx("^["+_dereq_("white-space-x").string2018+"]+"),replace="".replace,$trimLeft2018=function trimLeft2018(string){return replace.call(requireCoercibleToString(string),reLeft2018,"")};module.exports={trimLeft:$trimLeft2018,trimLeft2016:function trimLeft2016(string){return replace.call(requireCoercibleToString(string),reLeft2016,"")},trimLeft2018:$trimLeft2018}},{"cached-constructors-x":2,"require-coercible-to-string-x":6,"white-space-x":12}],10:[function(_dereq_,module,exports){/**
* @file This method removes whitespace from the right end of a string.
* @version 2.0.1
* @version 3.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -70,5 +70,5 @@ * @copyright Xotic750

*/
"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":12}],11:[function(_dereq_,module,exports){"use strict";module.exports=function isUndefined(value){return void 0===value}},{}],12:[function(_dereq_,module,exports){/**
* @file List of ECMAScript5 white space characters.
* @version 2.0.3
"use strict";var requireCoercibleToString=_dereq_("require-coercible-to-string-x"),Rx=_dereq_("cached-constructors-x").RegExp,reRight2016=new Rx("["+_dereq_("white-space-x").string2016+"]+$"),reRight2018=new Rx("["+_dereq_("white-space-x").string2018+"]+$"),replace="".replace,$trimRight2018=function trimRight2018(string){return replace.call(requireCoercibleToString(string),reRight2018,"")};module.exports={trimRight:$trimRight2018,trimRight2016:function trimRight2016(string){return replace.call(requireCoercibleToString(string),reRight2016,"")},trimRight2018:$trimRight2018}},{"cached-constructors-x":2,"require-coercible-to-string-x":6,"white-space-x":12}],11:[function(_dereq_,module,exports){"use strict";module.exports=function isUndefined(value){return void 0===value}},{}],12:[function(_dereq_,module,exports){/**
* @file List of ECMAScript white space characters.
* @version 3.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -79,2 +79,2 @@ * @copyright Xotic750

*/
"use strict";for(var list=[{code:9,description:"Tab",string:"\t"},{code:10,description:"Line Feed",string:"\n"},{code:11,description:"Vertical Tab",string:"\x0B"},{code:12,description:"Form Feed",string:"\f"},{code:13,description:"Carriage Return",string:"\r"},{code:32,description:"Space",string:" "},{code:160,description:"No-break space",string:"\xa0"},{code:5760,description:"Ogham space mark",string:"\u1680"},{code:6158,description:"Mongolian vowel separator",string:"\u180e"},{code:8192,description:"En quad",string:"\u2000"},{code:8193,description:"Em quad",string:"\u2001"},{code:8194,description:"En space",string:"\u2002"},{code:8195,description:"Em space",string:"\u2003"},{code:8196,description:"Three-per-em space",string:"\u2004"},{code:8197,description:"Four-per-em space",string:"\u2005"},{code:8198,description:"Six-per-em space",string:"\u2006"},{code:8199,description:"Figure space",string:"\u2007"},{code:8200,description:"Punctuation space",string:"\u2008"},{code:8201,description:"Thin space",string:"\u2009"},{code:8202,description:"Hair space",string:"\u200a"},{code:8232,description:"Line separator",string:"\u2028"},{code:8233,description:"Paragraph separator",string:"\u2029"},{code:8239,description:"Narrow no-break space",string:"\u202f"},{code:8287,description:"Medium mathematical space",string:"\u205f"},{code:12288,description:"Ideographic space",string:"\u3000"},{code:65279,description:"Byte Order Mark",string:"\ufeff"}],string="",length=list.length,i=0;i<length;i+=1)string+=list[i].string;module.exports={list:list,string:string}},{}]},{},[1])(1)});
"use strict";for(var list=[{code:9,description:"Tab",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\t"},{code:10,description:"Line Feed",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\n"},{code:11,description:"Vertical Tab",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\x0B"},{code:12,description:"Form Feed",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\f"},{code:13,description:"Carriage Return",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\r"},{code:32,description:"Space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:160,description:"No-break space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\xa0"},{code:5760,description:"Ogham space mark",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u1680"},{code:6158,description:"Mongolian vowel separator",es5:!0,es2015:!0,es2016:!0,es2017:!1,es2018:!1,string:"\u180e"},{code:8192,description:"En quad",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2000"},{code:8193,description:"Em quad",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2001"},{code:8194,description:"En space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2002"},{code:8195,description:"Em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2003"},{code:8196,description:"Three-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2004"},{code:8197,description:"Four-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2005"},{code:8198,description:"Six-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2006"},{code:8199,description:"Figure space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2007"},{code:8200,description:"Punctuation space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2008"},{code:8201,description:"Thin space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2009"},{code:8202,description:"Hair space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u200a"},{code:8232,description:"Line separator",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2028"},{code:8233,description:"Paragraph separator",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2029"},{code:8239,description:"Narrow no-break space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u202f"},{code:8287,description:"Medium mathematical space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u205f"},{code:12288,description:"Ideographic space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u3000"},{code:65279,description:"Byte Order Mark",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\ufeff"}],stringES2016="",stringES2018="",length=list.length,i=0;i<length;i+=1)list[i].es2016&&(stringES2016+=list[i].string),list[i].es2018&&(stringES2018+=list[i].string);module.exports={list:list,string:stringES2018,string5:stringES2016,string2015:stringES2016,string2016:stringES2016,string2017:stringES2018,string2018:stringES2018}},{}]},{},[1])(1)});
{
"name": "trim-x",
"version": "2.0.2",
"version": "3.0.0",
"description": "This method removes whitespace from the left and right end of a string.",

@@ -32,4 +32,4 @@ "homepage": "https://github.com/Xotic750/trim-x",

"dependencies": {
"trim-left-x": "^2.0.1",
"trim-right-x": "^2.0.1"
"trim-left-x": "^3.0.0",
"trim-right-x": "^3.0.0"
},

@@ -36,0 +36,0 @@ "devDependencies": {

@@ -26,12 +26,25 @@ <a href="https://travis-ci.org/Xotic750/trim-x"

**Version**: 2.0.2
**Version**: 3.0.0
**Author**: Xotic750 <Xotic750@gmail.com>
**License**: [MIT](&lt;https://opensource.org/licenses/MIT&gt;)
**Copyright**: Xotic750
<a name="exp_module_trim-x--module.exports"></a>
### `module.exports(string)` ⇒ <code>string</code> ⏏
* [trim-x](#module_trim-x)
* [`.trim`](#module_trim-x.trim)
* [`.trim2016`](#module_trim-x.trim2016) ⇒ <code>string</code>
* [`.trim2018`](#module_trim-x.trim2018) ⇒ <code>string</code>
<a name="module_trim-x.trim"></a>
### `trim-x.trim`
A reference to trim2018.
**Kind**: static property of [<code>trim-x</code>](#module_trim-x)
<a name="module_trim-x.trim2016"></a>
### `trim-x.trim2016` ⇒ <code>string</code>
This method removes whitespace from the left and right end of a string.
(ES2016)
**Kind**: Exported function
**Kind**: static property of [<code>trim-x</code>](#module_trim-x)
**Returns**: <code>string</code> - The trimmed string.

@@ -53,1 +66,24 @@ **Throws**:

```
<a name="module_trim-x.trim2018"></a>
### `trim-x.trim2018` ⇒ <code>string</code>
This method removes whitespace from the left and right end of a string.
(ES2018)
**Kind**: static property of [<code>trim-x</code>](#module_trim-x)
**Returns**: <code>string</code> - The trimmed string.
**Throws**:
- <code>TypeError</code> If string is null or undefined or not coercible.
| Param | Type | Description |
| --- | --- | --- |
| string | <code>string</code> | The string to trim the whitespace from. |
**Example**
```js
var trim = require('trim-x');
trim(' \t\na \t\n') === 'a'; // 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