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

string.prototype.trimright

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string.prototype.trimright - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

.editorconfig

15

CHANGELOG.md

@@ -0,1 +1,16 @@

2.1.0 / 2019-09-09
=================
* [New] add `auto` entry point
* [Deps] update `function-bind`, `define-properties`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape`, `@es-shims/api`
* [meta] clean up scripts
* [meta] Only apps should have lockfiles
* [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v9.11`, `v8.16`, `v7.10`, `v6.17`, `v5.10`, `v4.9`; use `nvm install-latest-npm`
* [Tests] allow a name of `trimLeft` or `trimStart`
* [Tests] fix tests for the mongolian vowel separator
* [Tests] use `functions-have-names`
* [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops
* [Tests] remove `jscs`
* [Tests] use pretest/posttest for linting/security
2.0.0 / 2016-02-06

@@ -2,0 +17,0 @@ =================

2

implementation.js

@@ -6,3 +6,5 @@ 'use strict';

/* eslint-disable no-control-regex */
var rightWhitespace = /[\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]*$/;
/* eslint-enable no-control-regex */

@@ -9,0 +11,0 @@ module.exports = function trimRight() {

33

package.json
{
"name": "string.prototype.trimright",
"version": "2.0.0",
"version": "2.1.0",
"author": "Jordan Harband",

@@ -9,12 +9,10 @@ "description": "ES7 spec-compliant String.prototype.trimRight shim.",

"scripts": {
"test": "npm run lint && es-shim-api --bound && npm run tests-only && npm run security",
"pretest": "npm run lint && es-shim-api --bound",
"test": "npm run tests-only",
"posttest": "npx aud",
"tests-only": "npm run test:shimmed && npm run test:module",
"test:shimmed": "node test/shimmed.js",
"test:module": "node test/index.js",
"test:shimmed": "node test/shimmed",
"test:module": "node test",
"coverage": "covert test/*.js",
"coverage-quiet": "covert test/*.js --quiet",
"lint": "npm run jscs && npm run eslint",
"eslint": "eslint test/*.js *.js",
"jscs": "jscs test/*.js *.js",
"security": "nsp check"
"lint": "eslint ."
},

@@ -37,13 +35,12 @@ "repository": {

"dependencies": {
"define-properties": "^1.1.2",
"function-bind": "^1.0.2"
"define-properties": "^1.1.3",
"function-bind": "^1.1.1"
},
"devDependencies": {
"tape": "^4.4.0",
"covert": "^1.1.0",
"jscs": "^2.9.0",
"nsp": "^2.2.0",
"eslint": "^1.10.3",
"@ljharb/eslint-config": "^1.6.1",
"@es-shims/api": "^1.1.0"
"@es-shims/api": "^2.1.2",
"@ljharb/eslint-config": "^14.1.0",
"covert": "^1.1.1",
"eslint": "^6.3.0",
"functions-have-names": "^1.1.1",
"tape": "^4.11.0"
},

@@ -50,0 +47,0 @@ "testling": {

@@ -9,4 +9,4 @@ 'use strict';

t.test('bad array/this value', function (st) {
st.throws(function () { trimRight(undefined, 'a'); }, TypeError, 'undefined is not an object');
st.throws(function () { trimRight(null, 'a'); }, TypeError, 'null is not an object');
st['throws'](function () { trimRight(undefined, 'a'); }, TypeError, 'undefined is not an object');
st['throws'](function () { trimRight(null, 'a'); }, TypeError, 'null is not an object');
st.end();

@@ -13,0 +13,0 @@ });

@@ -12,3 +12,3 @@ 'use strict';

var isEnumerable = Object.prototype.propertyIsEnumerable;
var functionsHaveNames = function f() {}.name === 'f';
var functionsHaveNames = require('functions-have-names')();

@@ -18,3 +18,3 @@ test('shimmed', function (t) {

t.test('Function name', { skip: !functionsHaveNames }, function (st) {
st.equal(String.prototype.trimRight.name, 'trimRight', 'String#trimRight has name "trimRight"');
st.equal((/^(?:trimRight|trimEnd)$/).test(String.prototype.trimRight.name), true, 'String#trimRight has name "trimRight" or "trimEnd"');
st.end();

@@ -31,4 +31,4 @@ });

t.test('bad string/this value', { skip: !supportsStrictMode }, function (st) {
st.throws(function () { return trimRight(undefined, 'a'); }, TypeError, 'undefined is not an object');
st.throws(function () { return trimRight(null, 'a'); }, TypeError, 'null is not an object');
st['throws'](function () { return trimRight(undefined, 'a'); }, TypeError, 'undefined is not an object');
st['throws'](function () { return trimRight(null, 'a'); }, TypeError, 'null is not an object');
st.end();

@@ -35,0 +35,0 @@ });

@@ -8,3 +8,3 @@ 'use strict';

var allWhitespaceChars = '\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 allWhitespaceChars = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
st.equal(trimRight(allWhitespaceChars + 'a' + allWhitespaceChars), allWhitespaceChars + 'a', 'all expected whitespace chars are trimmed');

@@ -15,2 +15,9 @@

// see https://codeblog.jonskeet.uk/2014/12/01/when-is-an-identifier-not-an-identifier-attack-of-the-mongolian-vowel-separator/
var mongolianVowelSeparator = '\u180E';
t.test('unicode >= 4 && < 6.3', { skip: !(/^\s$/).test(mongolianVowelSeparator) }, function (st) {
st.equal(trimRight(mongolianVowelSeparator + 'a' + mongolianVowelSeparator), mongolianVowelSeparator + 'a', 'mongolian vowel separator is whitespace');
st.end();
});
t.test('zero-width spaces', function (st) {

@@ -17,0 +24,0 @@ var zeroWidth = '\u200b';

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