Socket
Socket
Sign inDemoInstall

trim-left-x

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trim-left-x - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

tests/run.js

33

index.js

@@ -27,20 +27,5 @@ /**

*
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2>
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5
* methods that can be faithfully emulated with a legacy JavaScript engine.
* Requires ES3 or above.
*
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible.
* For these methods, as closely as possible to ES5 is not very close.
* Many of these shams are intended only to allow code to be written to ES5
* without causing run-time errors in older engines. In many cases,
* this means that these shams cause many ES5 methods to silently fail.
* Decide carefully whether this is what you want. Note: es5-sham.js requires
* es5-shim.js to be able to work properly.
*
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully.
*
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines
* behave as closely as possible to ECMAScript 6 (Harmony).
*
* @version 1.0.0
* @version 1.1.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -52,12 +37,4 @@ * @copyright Xotic750

/* jslint maxlen:80, es6:true, white:true */
/* eslint strict: 1 */
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true,
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true,
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1,
maxstatements:3, maxcomplexity:2 */
/* eslint strict: 1, max-statements: 1, func-style: 1 */
/* global module */

@@ -69,5 +46,5 @@

var $toString = require('to-string-x');
var ws = require('white-space-x').ws;
var reLeft = new RegExp('^[' + ws + ']+');
var pReplace = String.prototype.replace;

@@ -85,4 +62,4 @@ /**

module.exports = function trimLeft(string) {
return pReplace.call(string, reLeft, '');
return $toString(string).replace(reLeft, '');
};
}());

@@ -28,20 +28,5 @@ (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){

*
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2>
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5
* methods that can be faithfully emulated with a legacy JavaScript engine.
* Requires ES3 or above.
*
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible.
* For these methods, as closely as possible to ES5 is not very close.
* Many of these shams are intended only to allow code to be written to ES5
* without causing run-time errors in older engines. In many cases,
* this means that these shams cause many ES5 methods to silently fail.
* Decide carefully whether this is what you want. Note: es5-sham.js requires
* es5-shim.js to be able to work properly.
*
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully.
*
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines
* behave as closely as possible to ECMAScript 6 (Harmony).
*
* @version 1.0.0
* @version 1.1.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -53,12 +38,4 @@ * @copyright Xotic750

/* jslint maxlen:80, es6:true, white:true */
/* eslint strict: 1 */
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true,
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true,
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1,
maxstatements:3, maxcomplexity:2 */
/* eslint strict: 1, max-statements: 1, func-style: 1 */
/* global module */

@@ -70,5 +47,5 @@

var $toString = _dereq_('to-string-x');
var ws = _dereq_('white-space-x').ws;
var reLeft = new RegExp('^[' + ws + ']+');
var pReplace = String.prototype.replace;

@@ -86,7 +63,7 @@ /**

module.exports = function trimLeft(string) {
return pReplace.call(string, reLeft, '');
return $toString(string).replace(reLeft, '');
};
}());
},{"white-space-x":10}],2:[function(_dereq_,module,exports){
},{"to-string-x":13,"white-space-x":15}],2:[function(_dereq_,module,exports){
/**

@@ -116,23 +93,9 @@ * @file

*
* Based on the original work by Jordan Harband
* {@link https://www.npmjs.com/package/define-properties `define-properties`}.
* Define multiple non-enumerable properties at once.
*
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2>
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5
* methods that can be faithfully emulated with a legacy JavaScript engine.
* Requires ES3 or above.
*
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible.
* For these methods, as closely as possible to ES5 is not very close.
* Many of these shams are intended only to allow code to be written to ES5
* without causing run-time errors in older engines. In many cases,
* this means that these shams cause many ES5 methods to silently fail.
* Decide carefully whether this is what you want. Note: es5-sham.js requires
* es5-shim.js to be able to work properly.
* @see {@link https://www.npmjs.com/package/define-properties|define-properties}
*
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully.
*
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines
* behave as closely as possible to ECMAScript 6 (Harmony).
*
* @version 1.2.0
* @version 1.3.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -144,10 +107,2 @@ * @copyright Xotic750

/* jslint maxlen:80, es6:true, white:true */
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true,
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true,
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1,
maxstatements:3, maxcomplexity:2 */
/* eslint strict: 1, max-statements: 1, id-length: 1, no-restricted-syntax: 1,

@@ -165,5 +120,4 @@ no-param-reassign: 1 */

var isUndefined = _dereq_('validate.io-undefined');
var pConcat = Array.prototype.concat;
var pForEach = Array.prototype.forEach;
var $keys = Object.keys;
var forEach = _dereq_('foreach');
var $keys = isFunction(Object.keys) ? Object.keys : _dereq_('object-keys');
var $getOwnPropertySymbols = isFunction(Object.getOwnPropertySymbols) && Object.getOwnPropertySymbols;

@@ -225,5 +179,5 @@ var $defineProperty = isFunction(Object.defineProperty) && Object.defineProperty;

if (hasSymbols && $getOwnPropertySymbols) {
props = pConcat.call(props, $getOwnPropertySymbols(map));
props = props.concat($getOwnPropertySymbols(map));
}
pForEach.call(props, function (name) {
forEach(props, function (name) {
var predicate = preds[name];

@@ -293,3 +247,27 @@ property(

},{"has-symbol-support-x":3,"is-function-x":5,"validate.io-undefined":9}],3:[function(_dereq_,module,exports){
},{"foreach":3,"has-symbol-support-x":4,"is-function-x":6,"object-keys":10,"validate.io-undefined":14}],3:[function(_dereq_,module,exports){
var hasOwn = Object.prototype.hasOwnProperty;
var toString = Object.prototype.toString;
module.exports = function forEach (obj, fn, ctx) {
if (toString.call(fn) !== '[object Function]') {
throw new TypeError('iterator must be a function');
}
var l = obj.length;
if (l === +l) {
for (var i = 0; i < l; i++) {
fn.call(ctx, obj[i], i, obj);
}
} else {
for (var k in obj) {
if (hasOwn.call(obj, k)) {
fn.call(ctx, obj[k], k, obj);
}
}
}
};
},{}],4:[function(_dereq_,module,exports){
/**

@@ -319,23 +297,7 @@ * @file

*
* hasSymbolSupport module. Tests if `Symbol` exists and creates the correct
* type.
* Tests if `Symbol` exists and creates the correct type.
*
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2>
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5
* methods that can be faithfully emulated with a legacy JavaScript engine.
* Requires ES3 or above.
*
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible.
* For these methods, as closely as possible to ES5 is not very close.
* Many of these shams are intended only to allow code to be written to ES5
* without causing run-time errors in older engines. In many cases,
* this means that these shams cause many ES5 methods to silently fail.
* Decide carefully whether this is what you want. Note: es5-sham.js requires
* es5-shim.js to be able to work properly.
*
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully.
*
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines
* behave as closely as possible to ECMAScript 6 (Harmony).
*
* @version 1.1.0
* @version 1.2.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -347,12 +309,4 @@ * @copyright Xotic750

/* jslint maxlen:80, es6:true, white:true */
/* eslint strict: 1, symbol-description: 1 */
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true,
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true,
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1,
maxstatements:3, maxcomplexity:2 */
/* eslint strict: 1, max-statements: 1, symbol-description: 1 */
/* global module */

@@ -373,3 +327,3 @@

},{}],4:[function(_dereq_,module,exports){
},{}],5:[function(_dereq_,module,exports){
/**

@@ -399,22 +353,9 @@ * @file

*
* hasToStringTag tests if @@toStringTag is supported. `true` if supported.
* Tests if ES6 @@toStringTag is supported.
*
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2>
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5
* methods that can be faithfully emulated with a legacy JavaScript engine.
* Requires ES3 or above.
*
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible.
* For these methods, as closely as possible to ES5 is not very close.
* Many of these shams are intended only to allow code to be written to ES5
* without causing run-time errors in older engines. In many cases,
* this means that these shams cause many ES5 methods to silently fail.
* Decide carefully whether this is what you want. Note: es5-sham.js requires
* es5-shim.js to be able to work properly.
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-@@tostringtag|26.3.1 @@toStringTag}
*
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully.
*
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines
* behave as closely as possible to ECMAScript 6 (Harmony).
*
* @version 1.1.0
* @version 1.2.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -426,12 +367,4 @@ * @copyright Xotic750

/* jslint maxlen:80, es6:true, white:true */
/* eslint strict: 1 */
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true,
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true,
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1,
maxstatements:3, maxcomplexity:2 */
/* eslint strict: 1, max-statements: 1 */
/* global module */

@@ -452,3 +385,3 @@

},{"has-symbol-support-x":3}],5:[function(_dereq_,module,exports){
},{"has-symbol-support-x":4}],6:[function(_dereq_,module,exports){
/**

@@ -478,22 +411,5 @@ * @file

*
* isFunction module. Determine whether a given value is a function object.
* Determine whether a given value is a function object.
*
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2>
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5
* methods that can be faithfully emulated with a legacy JavaScript engine.
*
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible.
* For these methods, as closely as possible to ES5 is not very close.
* Many of these shams are intended only to allow code to be written to ES5
* without causing run-time errors in older engines. In many cases,
* this means that these shams cause many ES5 methods to silently fail.
* Decide carefully whether this is what you want. Note: es5-sham.js requires
* es5-shim.js to be able to work properly.
*
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully.
*
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines
* behave as closely as possible to ECMAScript 6 (Harmony).
*
* @version 1.1.0
* @version 1.2.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -505,12 +421,4 @@ * @copyright Xotic750

/* jslint maxlen:80, es6:true, white:true */
/* eslint strict: 1 */
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true,
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true,
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1,
maxstatements:3, maxcomplexity:2 */
/* eslint strict: 1, max-statements: 1 */
/* global module */

@@ -528,2 +436,3 @@

var genTag = '[object GeneratorFunction]';
var asyncTag = '[object AsyncFunction]';

@@ -538,3 +447,3 @@ /**

*/
var tryFunctionObject = function (value) {
var tryFuncToString = function funcToString(value) {
try {

@@ -573,10 +482,10 @@ fToString.call(value);

if (hasToStringTag) {
return tryFunctionObject(value);
return tryFuncToString(value);
}
var strTag = toStringTag(value);
return strTag === funcTag || strTag === genTag;
return strTag === funcTag || strTag === genTag || strTag === asyncTag;
};
}());
},{"has-to-string-tag-x":4,"is-primitive":6,"to-string-tag-x":8}],6:[function(_dereq_,module,exports){
},{"has-to-string-tag-x":5,"is-primitive":7,"to-string-tag-x":12}],7:[function(_dereq_,module,exports){
/*!

@@ -596,3 +505,32 @@ * is-primitive <https://github.com/jonschlinkert/is-primitive>

},{}],7:[function(_dereq_,module,exports){
},{}],8:[function(_dereq_,module,exports){
'use strict';
var toStr = Object.prototype.toString;
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
if (hasSymbols) {
var symToStr = Symbol.prototype.toString;
var symStringRegex = /^Symbol\(.*\)$/;
var isSymbolObject = function isSymbolObject(value) {
if (typeof value.valueOf() !== 'symbol') { return false; }
return symStringRegex.test(symToStr.call(value));
};
module.exports = function isSymbol(value) {
if (typeof value === 'symbol') { return true; }
if (toStr.call(value) !== '[object Symbol]') { return false; }
try {
return isSymbolObject(value);
} catch (e) {
return false;
}
};
} else {
module.exports = function isSymbol(value) {
// this environment does not support Symbols.
return false;
};
}
},{}],9:[function(_dereq_,module,exports){
/**

@@ -629,3 +567,164 @@ * lodash 3.0.0 (Custom Build) <https://lodash.com/>

},{}],8:[function(_dereq_,module,exports){
},{}],10:[function(_dereq_,module,exports){
'use strict';
// modified from https://github.com/es-shims/es5-shim
var has = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var slice = Array.prototype.slice;
var isArgs = _dereq_('./isArguments');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
var dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
];
var equalsConstructorPrototype = function (o) {
var ctor = o.constructor;
return ctor && ctor.prototype === o;
};
var excludedKeys = {
$console: true,
$external: true,
$frame: true,
$frameElement: true,
$frames: true,
$innerHeight: true,
$innerWidth: true,
$outerHeight: true,
$outerWidth: true,
$pageXOffset: true,
$pageYOffset: true,
$parent: true,
$scrollLeft: true,
$scrollTop: true,
$scrollX: true,
$scrollY: true,
$self: true,
$webkitIndexedDB: true,
$webkitStorageInfo: true,
$window: true
};
var hasAutomationEqualityBug = (function () {
/* global window */
if (typeof window === 'undefined') { return false; }
for (var k in window) {
try {
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
try {
equalsConstructorPrototype(window[k]);
} catch (e) {
return true;
}
}
} catch (e) {
return true;
}
}
return false;
}());
var equalsConstructorPrototypeIfNotBuggy = function (o) {
/* global window */
if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
return equalsConstructorPrototype(o);
}
try {
return equalsConstructorPrototype(o);
} catch (e) {
return false;
}
};
var keysShim = function keys(object) {
var isObject = object !== null && typeof object === 'object';
var isFunction = toStr.call(object) === '[object Function]';
var isArguments = isArgs(object);
var isString = isObject && toStr.call(object) === '[object String]';
var theKeys = [];
if (!isObject && !isFunction && !isArguments) {
throw new TypeError('Object.keys called on a non-object');
}
var skipProto = hasProtoEnumBug && isFunction;
if (isString && object.length > 0 && !has.call(object, 0)) {
for (var i = 0; i < object.length; ++i) {
theKeys.push(String(i));
}
}
if (isArguments && object.length > 0) {
for (var j = 0; j < object.length; ++j) {
theKeys.push(String(j));
}
} else {
for (var name in object) {
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
theKeys.push(String(name));
}
}
}
if (hasDontEnumBug) {
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
for (var k = 0; k < dontEnums.length; ++k) {
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
theKeys.push(dontEnums[k]);
}
}
}
return theKeys;
};
keysShim.shim = function shimObjectKeys() {
if (Object.keys) {
var keysWorksWithArguments = (function () {
// Safari 5.0 bug
return (Object.keys(arguments) || '').length === 2;
}(1, 2));
if (!keysWorksWithArguments) {
var originalKeys = Object.keys;
Object.keys = function keys(object) {
if (isArgs(object)) {
return originalKeys(slice.call(object));
} else {
return originalKeys(object);
}
};
}
} else {
Object.keys = keysShim;
}
return Object.keys || keysShim;
};
module.exports = keysShim;
},{"./isArguments":11}],11:[function(_dereq_,module,exports){
'use strict';
var toStr = Object.prototype.toString;
module.exports = function isArguments(value) {
var str = toStr.call(value);
var isArgs = str === '[object Arguments]';
if (!isArgs) {
isArgs = str !== '[object Array]' &&
value !== null &&
typeof value === 'object' &&
typeof value.length === 'number' &&
value.length >= 0 &&
toStr.call(value.callee) === '[object Function]';
}
return isArgs;
};
},{}],12:[function(_dereq_,module,exports){
/**

@@ -653,35 +752,9 @@ * @file

*
* Get an object's @@toStringTag. Includes fixes to correct ES3 differences
* for the following.
* - undefined => '[object Undefined]'
* - null => '[object Null]'
* Get an object's ES6 @@toStringTag.
*
* No other fixes are included, so legacy `arguments` will
* give `[object Object]`, and many older native objects
* give `[object Object]`. There are also other environmental bugs
* for example `RegExp` gives `[object Function]` and `Uint8Array`
* gives `[object Object]` on certain engines. While these and more could
* be fixed, it was decided that this should be a very raw version and it
* is left to the coder to use other `is` implimentations for detection.
* It is also worth noting that as of ES6 `Symbol.toStringTag` can be set on
* an object and therefore can report any string that it wishes.
* Requires ES3 or above.
*
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2>
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5
* methods that can be faithfully emulated with a legacy JavaScript engine.
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring|19.1.3.6 Object.prototype.toString ( )}
*
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible.
* For these methods, as closely as possible to ES5 is not very close.
* Many of these shams are intended only to allow code to be written to ES5
* without causing run-time errors in older engines. In many cases,
* this means that these shams cause many ES5 methods to silently fail.
* Decide carefully whether this is what you want. Note: es5-sham.js requires
* es5-shim.js to be able to work properly.
*
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully.
*
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines
* behave as closely as possible to ECMAScript 6 (Harmony).
*
* @version 1.1.0
* @version 1.2.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -693,12 +766,4 @@ * @copyright Xotic750

/* jslint maxlen:80, es6:true, white:true */
/* eslint strict: 1 */
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true,
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true,
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1,
maxstatements:3, maxcomplexity:2 */
/* eslint strict: 1, max-statements: 1 */
/* global module */

@@ -710,3 +775,2 @@

var pToString = Object.prototype.toString;
var isNull = _dereq_('lodash.isnull');

@@ -716,2 +780,3 @@ var isUndefined = _dereq_('validate.io-undefined');

var undefTag = '[object Undefined]';
var toStr = Object.prototype.toString;

@@ -736,8 +801,80 @@ /**

}
return pToString.call(value);
return toStr.call(value);
};
}());
},{"lodash.isnull":7,"validate.io-undefined":9}],9:[function(_dereq_,module,exports){
},{"lodash.isnull":9,"validate.io-undefined":14}],13:[function(_dereq_,module,exports){
/**
* @file
* <a href="https://travis-ci.org/Xotic750/to-string-x"
* title="Travis status">
* <img src="https://travis-ci.org/Xotic750/to-string-x.svg?branch=master"
* alt="Travis status" height="18">
* </a>
* <a href="https://david-dm.org/Xotic750/to-string-x"
* title="Dependency status">
* <img src="https://david-dm.org/Xotic750/to-string-x.svg"
* alt="Dependency status" height="18"/>
* </a>
* <a href="https://david-dm.org/Xotic750/to-string-x#info=devDependencies"
* title="devDependency status">
* <img src="https://david-dm.org/Xotic750/to-string-x/dev-status.svg"
* alt="devDependency status" height="18"/>
* </a>
* <a href="https://badge.fury.io/js/to-string-x" title="npm version">
* <img src="https://badge.fury.io/js/to-string-x.svg"
* alt="npm version" height="18">
* </a>
*
* ES6-compliant shim for ToString.
*
* Requires ES3 or above.
*
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tostring|7.1.12 ToString ( argument )}
*
* @version 1.2.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-string-x
*/
/* eslint strict: 1 */
/* global module */
;(function () { // eslint-disable-line no-extra-semi
'use strict';
var isSymbol = _dereq_('is-symbol');
/**
* The abstract operation ToString converts argument to a value of type
* String.
*
* @param {*} value The value to convert to a string.
* @throws {TypeError} If `value` is a Symbol.
* @return {string} The converted value.
* @example
* var $toString = require('to-string-x');
*
* $toString(); // 'undefined'
* $toString(null); // 'null'
* $toString('abc'); // 'abc'
* $toString(true); // 'true'
* $toString(Symbol('foo')); // TypeError
* $toString(Symbol.iterator); // TypeError
* $toString(Object(Symbol.iterator)); // TypeError
*/
module.exports = function ToString(value) {
if (isSymbol(value)) {
throw new TypeError('Cannot convert a Symbol value to a string');
}
return String(value);
};
}());
},{"is-symbol":8}],14:[function(_dereq_,module,exports){
/**
*

@@ -788,3 +925,3 @@ * VALIDATE: undefined

},{}],10:[function(_dereq_,module,exports){
},{}],15:[function(_dereq_,module,exports){
/**

@@ -812,22 +949,5 @@ * @file

*
* whitespace module.
* List of ECMAScript5 white space characters.
*
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2>
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5
* methods that can be faithfully emulated with a legacy JavaScript engine.
*
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible.
* For these methods, as closely as possible to ES5 is not very close.
* Many of these shams are intended only to allow code to be written to ES5
* without causing run-time errors in older engines. In many cases,
* this means that these shams cause many ES5 methods to silently fail.
* Decide carefully whether this is what you want. Note: es5-sham.js requires
* es5-shim.js to be able to work properly.
*
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully.
*
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines
* behave as closely as possible to ECMAScript 6 (Harmony).
*
* @version 1.1.0
* @version 1.2.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -839,12 +959,4 @@ * @copyright Xotic750

/* jslint maxlen:80, es6:true, white:true */
/* eslint strict: 1, max-len:1 */
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true,
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true,
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true,
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1,
maxstatements:3, maxcomplexity:2 */
/* eslint strict: 1, max-statements: 1, max-len:1 */
/* global module */

@@ -857,2 +969,3 @@

var define = _dereq_('define-properties-x');
var forEach = _dereq_('foreach');

@@ -932,2 +1045,7 @@ /**

var wsString = '';
forEach(module.exports.whiteSpaces, function (item) {
wsString += String.fromCharCode(item);
});
/**

@@ -945,9 +1063,6 @@ * A string of the whitespace characters.

*/
define.property(module.exports, 'ws', module.exports.whiteSpaces.reduce(function (acc, item) {
return acc + String.fromCharCode(item);
}, '')
);
define.property(module.exports, 'ws', wsString);
}());
},{"define-properties-x":2}]},{},[1])(1)
},{"define-properties-x":2,"foreach":3}]},{},[1])(1)
});

@@ -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,n,r){function s(i,u){if(!n[i]){if(!t[i]){var f="function"==typeof require&&require;if(!u&&f)return f(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var p=n[i]={exports:{}};t[i][0].call(p.exports,function(e){var n=t[i][1][e];return s(n?n:e)},p,p.exports,e,t,n,r)}return n[i].exports}for(var o="function"==typeof require&&require,i=0;i<r.length;i++)s(r[i]);return s}({1:[function(t,e,n){!function(){"use strict";var n=t("white-space-x").ws,r=new RegExp("^["+n+"]+"),o=String.prototype.replace;e.exports=function trimLeft(t){return o.call(t,r,"")}}()},{"white-space-x":10}],2:[function(t,e,n){!function(){"use strict";var n=t("has-symbol-support-x"),r=t("is-function-x"),o=t("validate.io-undefined"),i=Array.prototype.concat,u=Array.prototype.forEach,s=Object.keys,f=r(Object.getOwnPropertySymbols)&&Object.getOwnPropertySymbols,c=r(Object.defineProperty)&&Object.defineProperty,p=Boolean(c)&&function(){var t={};try{c(t,"x",{enumerable:!1,value:t});for(var e in t)return!1;return t.x===t}catch(t){return!1}}(),a=function(t,e,n,r){e in t&&!r||(p?c(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n)},l=function(t,e,c){var p=o(c)?{}:c,l=s(e);n&&f&&(l=i.call(l,f(e))),u.call(l,function(n){var o=p[n];a(t,n,e[n],r(o)&&o())})};l(e.exports,{properties:l,property:a,supportsDescriptors:p})}()},{"has-symbol-support-x":3,"is-function-x":5,"validate.io-undefined":9}],3:[function(t,e,n){!function(){"use strict";e.exports="function"==typeof Symbol&&"symbol"==typeof Symbol()}()},{}],4:[function(t,e,n){!function(){"use strict";e.exports=t("has-symbol-support-x")&&"symbol"==typeof Symbol.toStringTag}()},{"has-symbol-support-x":3}],5:[function(t,e,n){!function(){"use strict";var n=Function.prototype.toString,r=t("to-string-tag-x"),o=t("has-to-string-tag-x"),i=t("is-primitive"),u=function(t){try{return n.call(t),!0}catch(t){}return!1};e.exports=function isFunction(t){if(i(t))return!1;if(o)return u(t);var e=r(t);return"[object Function]"===e||"[object GeneratorFunction]"===e}}()},{"has-to-string-tag-x":4,"is-primitive":6,"to-string-tag-x":8}],6:[function(t,e,n){"use strict";e.exports=function isPrimitive(t){return null==t||"function"!=typeof t&&"object"!=typeof t}},{}],7:[function(t,e,n){function isNull(t){return null===t}e.exports=isNull},{}],8:[function(t,e,n){!function(){"use strict";var n=Object.prototype.toString,r=t("lodash.isnull"),o=t("validate.io-undefined");e.exports=function toStringTag(t){return r(t)?"[object Null]":o(t)?"[object Undefined]":n.call(t)}}()},{"lodash.isnull":7,"validate.io-undefined":9}],9:[function(t,e,n){"use strict";function isUndefined(t){return void 0===t}e.exports=isUndefined},{}],10:[function(t,e,n){!function(){"use strict";var n=t("define-properties-x");n.property(e.exports,"whiteSpaces",[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]),n.property(e.exports,"ws",e.exports.whiteSpaces.reduce(function(t,e){return t+String.fromCharCode(e)},""))}()},{"define-properties-x":2}]},{},[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,c){if(!r[i]){if(!t[i]){var u="function"==typeof require&&require;if(!c&&u)return u(i,!0);if(o)return o(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[i]={exports:{}};t[i][0].call(l.exports,function(e){var r=t[i][1][e];return s(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("to-string-x"),n=t("white-space-x").ws,o=new RegExp("^["+n+"]+");e.exports=function trimLeft(t){return r(t).replace(o,"")}}()},{"to-string-x":13,"white-space-x":15}],2:[function(t,e,r){!function(){"use strict";var r=t("has-symbol-support-x"),n=t("is-function-x"),o=t("validate.io-undefined"),i=t("foreach"),c=n(Object.keys)?Object.keys:t("object-keys"),u=n(Object.getOwnPropertySymbols)&&Object.getOwnPropertySymbols,s=n(Object.defineProperty)&&Object.defineProperty,f=Boolean(s)&&function(){var t={};try{s(t,"x",{enumerable:!1,value:t});for(var e in t)return!1;return t.x===t}catch(t){return!1}}(),l=function(t,e,r,n){e in t&&!n||(f?s(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},a=function(t,e,s){var f=o(s)?{}:s,a=c(e);r&&u&&(a=a.concat(u(e))),i(a,function(r){var o=f[r];l(t,r,e[r],n(o)&&o())})};a(e.exports,{properties:a,property:l,supportsDescriptors:f})}()},{foreach:3,"has-symbol-support-x":4,"is-function-x":6,"object-keys":10,"validate.io-undefined":14}],3:[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 c=0;c<i;c++)e.call(r,t[c],c,t);else for(var u in t)n.call(t,u)&&e.call(r,t[u],u,t)}},{}],4:[function(t,e,r){!function(){"use strict";e.exports="function"==typeof Symbol&&"symbol"==typeof Symbol()}()},{}],5:[function(t,e,r){!function(){"use strict";e.exports=t("has-symbol-support-x")&&"symbol"==typeof Symbol.toStringTag}()},{"has-symbol-support-x":4}],6:[function(t,e,r){!function(){"use strict";var r=Function.prototype.toString,n=t("to-string-tag-x"),o=t("has-to-string-tag-x"),i=t("is-primitive"),c=function funcToString(t){try{return r.call(t),!0}catch(t){}return!1};e.exports=function isFunction(t){if(i(t))return!1;if(o)return c(t);var e=n(t);return"[object Function]"===e||"[object GeneratorFunction]"===e||"[object AsyncFunction]"===e}}()},{"has-to-string-tag-x":5,"is-primitive":7,"to-string-tag-x":12}],7:[function(t,e,r){"use strict";e.exports=function isPrimitive(t){return null==t||"function"!=typeof t&&"object"!=typeof t}},{}],8:[function(t,e,r){"use strict";var n=Object.prototype.toString;if("function"==typeof Symbol&&"symbol"==typeof Symbol()){var o=Symbol.prototype.toString,i=/^Symbol\(.*\)$/,c=function isSymbolObject(t){return"symbol"==typeof t.valueOf()&&i.test(o.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(t){return!1}}}else e.exports=function isSymbol(t){return!1}},{}],9:[function(t,e,r){function isNull(t){return null===t}e.exports=isNull},{}],10:[function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=Array.prototype.slice,c=t("./isArguments"),u=Object.prototype.propertyIsEnumerable,s=!u.call({toString:null},"toString"),f=u.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=function(t){var e=t.constructor;return e&&e.prototype===t},p={$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},y=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!p["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{a(window[t])}catch(t){return!0}}catch(t){return!0}return!1}(),b=function(t){if("undefined"==typeof window||!y)return a(t);try{return a(t)}catch(t){return!1}},d=function keys(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),i=c(t),u=e&&"[object String]"===o.call(t),a=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=f&&r;if(u&&t.length>0&&!n.call(t,0))for(var y=0;y<t.length;++y)a.push(String(y));if(i&&t.length>0)for(var d=0;d<t.length;++d)a.push(String(d));else for(var g in t)p&&"prototype"===g||!n.call(t,g)||a.push(String(g));if(s)for(var h=b(t),m=0;m<l.length;++m)h&&"constructor"===l[m]||!n.call(t,l[m])||a.push(l[m]);return a};d.shim=function shimObjectKeys(){if(Object.keys){if(!function(){return 2===(Object.keys(arguments)||"").length}(1,2)){var t=Object.keys;Object.keys=function keys(e){return t(c(e)?i.call(e):e)}}}else Object.keys=d;return Object.keys||d},e.exports=d},{"./isArguments":11}],11:[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}},{}],12:[function(t,e,r){!function(){"use strict";var r=t("lodash.isnull"),n=t("validate.io-undefined"),o=Object.prototype.toString;e.exports=function toStringTag(t){return r(t)?"[object Null]":n(t)?"[object Undefined]":o.call(t)}}()},{"lodash.isnull":9,"validate.io-undefined":14}],13:[function(t,e,r){!function(){"use strict";var r=t("is-symbol");e.exports=function ToString(t){if(r(t))throw new TypeError("Cannot convert a Symbol value to a string");return String(t)}}()},{"is-symbol":8}],14:[function(t,e,r){"use strict";function isUndefined(t){return void 0===t}e.exports=isUndefined},{}],15:[function(t,e,r){!function(){"use strict";var r=t("define-properties-x"),n=t("foreach");r.property(e.exports,"whiteSpaces",[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]);var o="";n(e.exports.whiteSpaces,function(t){o+=String.fromCharCode(t)}),r.property(e.exports,"ws",o)}()},{"define-properties-x":2,foreach:3}]},{},[1])(1)});
//# sourceMappingURL=lib/trim-left-x.map
{
"name": "trim-left-x",
"version": "1.0.0",
"version": "1.1.0",
"description": "This method removes whitespace from the left end of a string.",

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

"dependencies": {
"white-space-x": "^1.1.0"
"to-string-x": "^1.2.0",
"white-space-x": "^1.2.0"
},
"devDependencies": {
"@ljharb/eslint-config": "^11.0.0",
"browserify": "^14.1.0",
"browserify-derequire": "^0.9.4",
"es5-shim": "^4.5.9",
"es6-shim": "^0.35.3",
"es7-shim": "^6.0.0",
"eslint": "^3.17.1",
"eslint": "^3.18.0",
"eslint-plugin-import": "^2.2.0",
"json3": "^3.3.2",
"jscs": "^3.0.7",
"uglify-js": "^2.8.12",
"browserify": "^14.1.0",
"browserify-derequire": "^0.9.4",
"jasmine-node": "^1.14.5",
"jsdoc-to-markdown": "^3.0.0",
"nsp": "^2.6.3"
"json3": "^3.3.2",
"make-jasmine-spec-runner-html": "^1.1.0",
"nodemon": "^1.11.0",
"nsp": "^2.6.3",
"replace-x": "^1.1.1",
"uglify-js": "^2.8.18"
},
"scripts": {
"build": "npm run build:setver && npm run security && npm run eslint && npm run browserify && npm run uglify && npm run docs && npm run build:jasmine && npm test",
"build:jasmine": "make-jasmine-spec-runner-html",
"build:setver": "PKG_VER=$(node -p -e \"require('./package.json').version\") && replace-x \" @version .*\" \" @version ${PKG_VER}\" index.js",
"build:watch": "nodemon --watch index.js --watch package.json --exec 'npm run build'",
"docs": "jsdoc2md --name-format --example-lang js index.js > README.md",
"eslint": "eslint *.js tests/spec/*.js",
"security": "nsp check",
"test": "jasmine-node --matchall tests/spec/",
"security": "nsp check",
"style": "jscs index.js",
"eslint": "eslint *.js tests/spec/*.js",
"docs": "jsdoc2md --name-format --example-lang js index.js > README.md",
"build": "browserify -p browserify-derequire -e index.js -o lib/trim-left-x.js -u 'crypto' -s returnExports",
"build-uglify": "uglifyjs lib/trim-left-x.js -o lib/trim-left-x.min.js --compress --keep-fnames --mangle --beautify ascii_only=true,beautify=false --source-map lib/trim-left-x.map"
"test:watch": "nodemon --watch tests/spec/test.js --exec 'npm test'",
"browserify": "browserify -p browserify-derequire -e index.js -o lib/trim-left-x.js -u 'crypto' -s returnExports",
"uglify": "uglifyjs lib/trim-left-x.js -o lib/trim-left-x.min.js --compress --keep-fnames --mangle --beautify ascii_only=true,beautify=false --source-map lib/trim-left-x.map"
}
}

@@ -28,20 +28,5 @@ <a name="module_trim-left-x"></a>

<h2>ECMAScript compatibility shims for legacy JavaScript engines</h2>
`es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5
methods that can be faithfully emulated with a legacy JavaScript engine.
Requires ES3 or above.
`es5-sham.js` monkey-patches other ES5 methods as closely as possible.
For these methods, as closely as possible to ES5 is not very close.
Many of these shams are intended only to allow code to be written to ES5
without causing run-time errors in older engines. In many cases,
this means that these shams cause many ES5 methods to silently fail.
Decide carefully whether this is what you want. Note: es5-sham.js requires
es5-shim.js to be able to work properly.
`json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully.
`es6.shim.js` provides compatibility shims so that legacy JavaScript engines
behave as closely as possible to ECMAScript 6 (Harmony).
**Version**: 1.0.0
**Version**: 1.1.0
**Author**: Xotic750 <Xotic750@gmail.com>

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

### `module.exports(string)` ⇒ <code>undefined</code> &#124; <code>string</code> ⏏
### `module.exports(string)` ⇒ <code>undefined</code> \| <code>string</code> ⏏
This method removes whitespace from the left end of a string
**Kind**: Exported function
**Returns**: <code>undefined</code> &#124; <code>string</code> - The left trimmed string.
**Returns**: <code>undefined</code> \| <code>string</code> - The left trimmed string.

@@ -59,0 +44,0 @@ | Param | Type | Description |

Sorry, the diff of this file is not supported yet

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