New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sprint

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sprint

Complex sprintf() implementation

  • 0.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
714
increased by9.17%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

sprint is implementation of sprintf function from C++. If it is ran in Node.js envirnoment then it's used as module, otherwise module inserts sprint() function into global object (usually window).

Usage:

// Node.js
var sprint = require('sprint');
// Will return "b a"
console.log(sprint('%2$s %1$s', 'a', 'b'));

All standard format placeholders are supported with the exception of %p (lack of pointers in JavaScript) and %n (lack of references in JavaScript).

In addition, following non-standard features are supported:

  • n$ - number of the parameter allowing the parameters to be used multiple times or displayed in different order. It's not in C99, but it's POSIX entension, so support for it is already common.
  • %b and %B - a binary number
  • %D, %U, %O - practially their lowercase variants. Inserted in this list just because of their usage in Perl's printf() implementation.
  • %v - vectors (from Perl implementation of sprintf())

For more information, read documentation of sprintf() in other programming languages.

If certain feature doesn't exist and you think it should exist, feel free to make issue about it. Unless it's impossible to implement it, you can expect it in next major release.

And last thing before I will end this README file, have fun!

Keywords

FAQs

Package last updated on 02 Oct 2012

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