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

es-leftpad

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-leftpad

An ES2015 alternative to left-pad

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

es-leftpad

A Node 4.x compatible ES2015 alternative to left-pad

Install

$ npm install es-leftpad

Usage

leftpad = require('es-leftpad')

leftpad('foo', 5)
// => "  foo"

leftpad('foobar', 6)
// => "foobar"

leftpad(1, 2, 0)
// => "01"

Benchmark

Performance compared to left-pad using benchmark.js

  • Padding to 80 chars:
leftPad x 1,420,504 ops/sec ±0.45% (92 runs sampled)
es-leftPad x 4,607,534 ops/sec ±1.31% (91 runs sampled)
Padding to 8 ("999", 80, "0")): Fastest is es-leftPad
  • Padding to 40 chars:
leftPad x 2,602,721 ops/sec ±0.94% (89 runs sampled)
es-leftPad x 5,120,414 ops/sec ±0.58% (93 runs sampled)
Padding to 8 ("999", 40, "0")): Fastest is es-leftPad
  • Padding to 12 chars:
leftPad x 6,310,671 ops/sec ±0.53% (92 runs sampled)
es-leftPad x 5,318,553 ops/sec ±0.72% (92 runs sampled)
Padding to 12 (999, 12)): Fastest is leftPad

Tests

Passing all tests from left-pad/test.js

Keywords

FAQs

Package last updated on 08 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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