string.prototype.trimleft
Advanced tools
Comparing version 1.0.1 to 2.0.0
@@ -12,3 +12,6 @@ { | ||
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], | ||
"requireCurlyBraces": { | ||
"allExcept": [], | ||
"keywords": ["if", "else", "for", "while", "do", "try", "catch"] | ||
}, | ||
@@ -19,2 +22,17 @@ "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], | ||
"disallowSpaceBeforeComma": true, | ||
"disallowSpaceAfterComma": false, | ||
"disallowSpaceBeforeSemicolon": true, | ||
"disallowNodeTypes": [ | ||
"DebuggerStatement", | ||
"ForInStatement", | ||
"LabeledStatement", | ||
"SwitchCase", | ||
"SwitchStatement", | ||
"WithStatement" | ||
], | ||
"requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, | ||
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, | ||
@@ -67,3 +85,3 @@ "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, | ||
"requireDotNotation": true, | ||
"requireDotNotation": { "allExcept": ["keywords"] }, | ||
@@ -107,4 +125,39 @@ "requireParenthesesAroundIIFE": true, | ||
"requirePaddingNewLinesAfterUseStrict": true | ||
"requirePaddingNewLinesAfterUseStrict": true, | ||
"disallowArrowFunctions": true, | ||
"disallowMultiLineTernary": true, | ||
"validateOrderInObjectKeys": "asc-insensitive", | ||
"disallowIdenticalDestructuringNames": true, | ||
"disallowNestedTernaries": { "maxLevel": 1 }, | ||
"requireSpaceAfterComma": { "allExcept": ["trailing"] }, | ||
"requireAlignedMultilineParams": false, | ||
"requireSpacesInGenerator": { | ||
"afterStar": true | ||
}, | ||
"disallowSpacesInGenerator": { | ||
"beforeStar": true | ||
}, | ||
"disallowVar": false, | ||
"requireArrayDestructuring": false, | ||
"requireEnhancedObjectLiterals": false, | ||
"requireObjectDestructuring": false, | ||
"requireEarlyReturn": false, | ||
"requireCapitalizedConstructorsNew": { | ||
"allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] | ||
} | ||
} | ||
@@ -0,1 +1,9 @@ | ||
2.0.0 / 2016-02-06 | ||
================= | ||
* [Breaking] conform to the es-shim API | ||
* [Deps] update `define-properties` | ||
* [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` | ||
* [Tests] up to `node` `v5.5` | ||
* [Tests] fix npm upgrades on older nodes | ||
1.0.1 / 2015-07-29 | ||
@@ -2,0 +10,0 @@ ================= |
26
index.js
@@ -5,23 +5,15 @@ 'use strict'; | ||
var define = require('define-properties'); | ||
var replace = bind.call(Function.call, String.prototype.replace); | ||
var leftWhitespace = /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*/; | ||
var implementation = require('./implementation'); | ||
var getPolyfill = require('./polyfill'); | ||
var shim = require('./shim'); | ||
var trimLeft = function trimLeft() { | ||
return replace(this, leftWhitespace, ''); | ||
}; | ||
var bound = bind.call(Function.call, getPolyfill()); | ||
var boundTrimLeft = bind.call(Function.call, trimLeft); | ||
define(boundTrimLeft, { | ||
shim: function shimTrimLeft() { | ||
var zeroWidthSpace = '\u200b'; | ||
define(String.prototype, { trimLeft: trimLeft }, { | ||
trimLeft: function () { | ||
return zeroWidthSpace.trimLeft() !== zeroWidthSpace; | ||
} | ||
}); | ||
return String.prototype.trimLeft; | ||
} | ||
define(bound, { | ||
getPolyfill: getPolyfill, | ||
implementation: implementation, | ||
shim: shim | ||
}); | ||
module.exports = boundTrimLeft; | ||
module.exports = bound; |
{ | ||
"name": "string.prototype.trimleft", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"author": "Jordan Harband", | ||
@@ -9,3 +9,4 @@ "description": "ES7 spec-compliant String.prototype.trimLeft shim.", | ||
"scripts": { | ||
"test": "npm run lint && npm run test:shimmed && npm run test:module && npm run security", | ||
"test": "npm run lint && es-shim-api --bound && npm run tests-only && npm run security", | ||
"tests-only": "npm run test:shimmed && npm run test:module", | ||
"test:shimmed": "node test/shimmed.js", | ||
@@ -18,3 +19,3 @@ "test:module": "node test/index.js", | ||
"jscs": "jscs test/*.js *.js", | ||
"security": "nsp package" | ||
"security": "nsp check" | ||
}, | ||
@@ -33,15 +34,17 @@ "repository": { | ||
"trimRight", | ||
"polyfill" | ||
"polyfill", | ||
"es-shim API" | ||
], | ||
"dependencies": { | ||
"define-properties": "^1.1.1", | ||
"define-properties": "^1.1.2", | ||
"function-bind": "^1.0.2" | ||
}, | ||
"devDependencies": { | ||
"tape": "^4.0.1", | ||
"tape": "^4.4.0", | ||
"covert": "^1.1.0", | ||
"jscs": "^1.13.1", | ||
"nsp": "^1.0.3", | ||
"eslint": "^1.0.0-rc-3", | ||
"@ljharb/eslint-config": "^1.0.3" | ||
"jscs": "^2.9.0", | ||
"nsp": "^2.2.0", | ||
"eslint": "^1.10.3", | ||
"@ljharb/eslint-config": "^1.6.1", | ||
"@es-shims/api": "^1.1.0" | ||
}, | ||
@@ -48,0 +51,0 @@ "testling": { |
@@ -13,4 +13,6 @@ String.prototype.trimLeft <sup>[![Version Badge][npm-version-svg]][package-url]</sup> | ||
An ES7 spec-compliant `String.prototype.trimLeft` shim. Invoke its "shim" method to shim `String.prototype.trimLeft` if it is unavailable. | ||
A spec-proposal-compliant `String.prototype.trimLeft` shim. Invoke its "shim" method to shim `String.prototype.trimLeft` if it is unavailable. | ||
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](http://www.ecma-international.org/ecma-262/6.0/#sec-object.assign). In an ES6 environment, it will also work properly with `Symbol`s. | ||
Most common usage: | ||
@@ -17,0 +19,0 @@ ```js |
@@ -6,2 +6,4 @@ 'use strict'; | ||
var runTests = require('./tests'); | ||
test('as a function', function (t) { | ||
@@ -14,5 +16,5 @@ t.test('bad array/this value', function (st) { | ||
require('./tests')(trimLeft, t); | ||
runTests(trimLeft, t); | ||
t.end(); | ||
}); |
@@ -6,2 +6,4 @@ 'use strict'; | ||
var runTests = require('./tests'); | ||
var test = require('tape'); | ||
@@ -33,5 +35,5 @@ var defineProperties = require('define-properties'); | ||
require('./tests')(bind.call(Function.call, String.prototype.trimLeft), t); | ||
runTests(bind.call(Function.call, String.prototype.trimLeft), t); | ||
t.end(); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15254
15
205
48
7
Updateddefine-properties@^1.1.2