Skip to content

NextTuesday/python-format

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

python-format is implementation of Python's str.format. It works both in browser and in Node.js. If you want to use this in Node.js, just use npm install python-format in console.

var format = require('python-format')
console.log(format('Hello, {}!', 'world'))

If you want to use this in browser, download python-format.js, and if you want, pass it using your favorite JavaScript minifizer (I prefer UglifyJS, but you can use other minifizers).

For more details, see http://docs.python.org/py3k/library/stdtypes.html#str.format.

Changelog

1.0.2

  • Grouping of digits now works properly with @johnbellessa's patches.

1.0.1

  • -0 is returned instead of 0 when dealing with format('{:g}', -0).

1.0.0

  • First release

About

str.format() from Python in JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%