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

string.prototype.padstart

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string.prototype.padstart - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

.github/workflows/rebase.yml

18

CHANGELOG.md

@@ -0,1 +1,19 @@

3.1.0 / 2019-12-14
=================
* [New] add `auto` entry point
* [Refactor] use split-up `es-abstract` (77% bundle size decrease)
* [readme] remove testling
* [readme] Fixed syntax error in README (#12)
* [readme] Stage 4
* [Deps] update `define-properties`, `es-abstract`, `function-bind`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `functions-have-names`, `covert`, `tape`, `@es-shims/api`
* [meta] add `funding` field
* [meta] Only apps should have lockfiles.
* [Tests] use pretest/posttest for linting/security
* [Tests] use `functions-have-names`
* [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops
* [Tests] remove `jscs`
* [Tests] use shared travis-ci configs
* [actions] add automatic rebasing / merge commit blocking
3.0.0 / 2015-11-17

@@ -2,0 +20,0 @@ =================

23

implementation.js
'use strict';
var bind = require('function-bind');
var ES = require('es-abstract/es7');
var slice = bind.call(Function.call, String.prototype.slice);
var ToLength = require('es-abstract/2019/ToLength');
var ToString = require('es-abstract/2019/ToString');
var RequireObjectCoercible = require('es-abstract/2019/RequireObjectCoercible');
var callBound = require('es-abstract/helpers/callBound');
var $slice = callBound('String.prototype.slice');
module.exports = function padStart(maxLength) {
var O = ES.RequireObjectCoercible(this);
var S = ES.ToString(O);
var stringLength = ES.ToLength(S.length);
var O = RequireObjectCoercible(this);
var S = ToString(O);
var stringLength = ToLength(S.length);
var fillString;

@@ -15,7 +18,7 @@ if (arguments.length > 1) {

}
var filler = typeof fillString === 'undefined' ? '' : ES.ToString(fillString);
var filler = typeof fillString === 'undefined' ? '' : ToString(fillString);
if (filler === '') {
filler = ' ';
}
var intMaxLength = ES.ToLength(maxLength);
var intMaxLength = ToLength(maxLength);
if (intMaxLength <= stringLength) {

@@ -28,7 +31,7 @@ return S;

var remainingCodeUnits = fillLen - fLen;
filler += fLen > remainingCodeUnits ? slice(filler, 0, remainingCodeUnits) : filler;
filler += fLen > remainingCodeUnits ? $slice(filler, 0, remainingCodeUnits) : filler;
}
var truncatedStringFiller = filler.length > fillLen ? slice(filler, 0, fillLen) : filler;
var truncatedStringFiller = filler.length > fillLen ? $slice(filler, 0, fillLen) : filler;
return truncatedStringFiller + S;
};
'use strict';
var bind = require('function-bind');
var define = require('define-properties');
var ES = require('es-abstract/es7');
var RequireObjectCoercible = require('es-abstract/2019/RequireObjectCoercible');
var callBind = require('es-abstract/helpers/callBind');

@@ -11,6 +11,6 @@ var implementation = require('./implementation');

var bound = bind.call(Function.apply, implementation);
var bound = callBind.apply(getPolyfill());
var boundPadStart = function padStart(str, maxLength) {
ES.RequireObjectCoercible(str);
RequireObjectCoercible(str);
var args = [maxLength];

@@ -17,0 +17,0 @@ if (arguments.length > 2) {

{
"name": "string.prototype.padstart",
"version": "3.0.0",
"author": "Jordan Harband",
"description": "ES7 spec-compliant String.prototype.padStart shim.",
"version": "3.1.0",
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"description": "ES2017 spec-compliant String.prototype.padStart shim.",
"license": "MIT",
"main": "index.js",
"scripts": {
"test": "npm run lint && npm run tests-only && npm run security",
"tests-only": "es-shim-api --bound && npm run test:shimmed && npm run test:module",
"pretest": "npm run --silent lint",
"test": "npm run --silent tests-only",
"posttest": "npx aud",
"tests-only": "es-shim-api --bound && npm run --silent test:shimmed && npm run --silent test:module",
"test:shimmed": "node test/shimmed.js",

@@ -15,6 +20,3 @@ "test:module": "node test/index.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 ."
},

@@ -29,3 +31,4 @@ "repository": {

"string",
"ES7",
"ES8",
"ES2017",
"shim",

@@ -41,14 +44,13 @@ "trim",

"dependencies": {
"define-properties": "^1.1.2",
"es-abstract": "^1.4.3",
"function-bind": "^1.0.2"
"define-properties": "^1.1.3",
"es-abstract": "^1.17.0-next.1"
},
"devDependencies": {
"tape": "^4.2.2",
"covert": "^1.1.0",
"jscs": "^2.5.1",
"nsp": "^2.0.2",
"eslint": "^1.9.0",
"@ljharb/eslint-config": "^1.6.0",
"@es-shims/api": "^1.0.0"
"@es-shims/api": "^2.1.2",
"@ljharb/eslint-config": "^15.0.2",
"covert": "^1.1.1",
"eslint": "^6.7.2",
"function-bind": "^1.1.1",
"functions-have-names": "^1.2.0",
"tape": "^4.11.0"
},

@@ -55,0 +57,0 @@ "testling": {

@@ -11,8 +11,6 @@ # String.prototype.padStart <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![browser support][testling-svg]][testling-url]
An ES2017 spec-compliant `String.prototype.padStart` shim. Invoke its "shim" method to shim `String.prototype.padStart` if it is unavailable.
An ES7 spec-compliant `String.prototype.padStart` shim. Invoke its "shim" method to shim `String.prototype.padStart` 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](https://github.com/tc39/ecma262/pull/581).
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 proposal](https://github.com/tc39/proposal-string-pad-start-end).
Most common usage:

@@ -26,3 +24,3 @@ ```js

assert(padStart('foo', 2)) === 'foo'.padStart(2));
assert(padStart('foo', 2) === 'foo'.padStart(2));
```

@@ -41,4 +39,2 @@

[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.padStart#info=devDependencies
[testling-svg]: https://ci.testling.com/es-shims/String.prototype.padStart.png
[testling-url]: https://ci.testling.com/es-shims/String.prototype.padStart
[npm-badge-png]: https://nodei.co/npm/string.prototype.padstart.png?downloads=true&stars=true

@@ -45,0 +41,0 @@ [license-image]: http://img.shields.io/npm/l/string.prototype.padstart.svg

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

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

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

t.test('bad array/this value', function (st) {
st.throws(function () { padStart(undefined, 'a'); }, TypeError, 'undefined is not an object');
st.throws(function () { padStart(null, 'a'); }, TypeError, 'null is not an object');
st['throws'](function () { padStart(undefined, 'a'); }, TypeError, 'undefined is not an object');
st['throws'](function () { padStart(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 padStart(undefined, 'a'); }, TypeError, 'undefined is not an object');
st.throws(function () { return padStart(null, 'a'); }, TypeError, 'null is not an object');
st['throws'](function () { return padStart(undefined, 'a'); }, TypeError, 'undefined is not an object');
st['throws'](function () { return padStart(null, 'a'); }, TypeError, 'null is not an object');
st.end();

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

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