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

fast-format

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-format

A simplified version of Node.js util.format()

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-28%
Maintainers
1
Weekly downloads
 
Created
Source

fast-format Circle CI

This is a simplified version of Node.js util.format(). This supports only %s placeholder, but faster than that. This will be the best solution if you need speed rather than complex formatting.

Usage

Same as Node.js util.format().

format(formatString[, ...])

Example

var s = format('%s, %s!', 'Hello', 'world');
console.log(s);     // => 'Hello, world!'

Benchmark

var i, len, s = Date.now();
for (i = 0, len = 10000000; i < len; i++) {
    format('i = %s, len = %s', i, len);
}
console.log(Date.now() - s);

environment1: MacBook Air Early 2015 + Node.js v0.12.5

moduletime
fast-format2,072 msec
util.format11,571 msec
sprintf-js19,438 msec

environment2: Core i7 2.5GHz Windows 8.1 Pro + Internet Explorer 11

moduletime
fast-format25,302 msec
util.format40,550 msec
sprintf-js58,133 msec

sprintf-js is a JavaScript sprintf implementation for the browser and Node.js. It is slow but might not be inevitable because a high functional module.

Installation

via npm

npm install fast-format --save

via bower

bower install fast-format

Browser Support

Chrome, Firefox, Safari, Opera, and Internet Explorer 6+

License

MIT

Keywords

FAQs

Package last updated on 28 Jun 2015

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