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

string.prototype.trim

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string.prototype.trim - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

.editorconfig

12

CHANGELOG.md

@@ -0,1 +1,13 @@

1.2.0 / 2019-07-24
=================
* [New] add `auto` entry point
* [Deps] update `define-properties`, `es-abstract`, `function-bind`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `covert`, `replace`, `semver`, `tape`; remove `jscs`
* [Tests] fix tests for the mongolian vowel separator
* [Tests] up to `node` `v12.6`, `v11.15`, `v10.16`, `v9.11`, `v8.16`, `v7.10`, `v6.17`, `v5.12`, `4.9`; use `nvm install-latest-npm`
* [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops
* [Tests] use `functions-have-names`
* [Tests] use pretest/posttest for linting/security
* [meta] Only apps should have lockfiles
1.1.2 / 2016-02-06

@@ -2,0 +14,0 @@ =================

2

implementation.js

@@ -7,4 +7,6 @@ 'use strict';

/* eslint-disable no-control-regex */
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 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 */

@@ -11,0 +13,0 @@ module.exports = function trim() {

39

package.json
{
"name": "string.prototype.trim",
"version": "1.1.2",
"version": "1.2.0",
"author": {

@@ -20,12 +20,10 @@ "name": "Jordan Harband",

"scripts": {
"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",
"pretest": "npm run --silent lint && es-shim-api --bound",
"test": "npm run --silent tests-only",
"posttest": "npx aud",
"tests-only": "npm run --silent test:shimmed && npm run --silent test:module",
"test:shimmed": "node test/shimmed.js",
"test:module": "node test/index.js",
"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"
"coverage": "covert test/{index,shimmed}*.js",
"lint": "eslint ."
},

@@ -46,16 +44,15 @@ "repository": {

"dependencies": {
"define-properties": "^1.1.2",
"es-abstract": "^1.5.0",
"function-bind": "^1.0.2"
"define-properties": "^1.1.3",
"es-abstract": "^1.13.0",
"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",
"semver": "^5.1.0",
"replace": "^0.3.0",
"@ljharb/eslint-config": "^1.6.1",
"@es-shims/api": "^1.0.0"
"@es-shims/api": "^2.1.2",
"@ljharb/eslint-config": "^13.1.1",
"covert": "^1.1.1",
"eslint": "^5.16.0",
"functions-have-names": "^1.1.0",
"replace": "^1.1.0",
"semver": "^6.2.0",
"tape": "^4.11.0"
},

@@ -62,0 +59,0 @@ "testling": {

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

var polyfill = getPolyfill();
define(String.prototype, { trim: polyfill }, { trim: function () { return String.prototype.trim !== polyfill; } });
define(String.prototype, { trim: polyfill }, {
trim: function testTrim() {
return String.prototype.trim !== polyfill;
}
});
return polyfill;
};

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

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

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

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

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

@@ -30,4 +30,4 @@ var runTests = require('./tests');

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

@@ -34,0 +34,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(trim(allWhitespaceChars + 'a' + 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(trim(mongolianVowelSeparator + 'a' + 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