jformat

1.1.0 • Public • Published

JFormat

Node Version Downloads Travis

Python function str.format for JavaScript

Installation

Module available through the npm registry. It can be installed using the npm or yarn command line tools.

# NPM 
npm install jformat --save
# Or Using Yarn 
yarn add jformat

Example

"Forever {Python}".format({Python: "JavaScript"});
// "Forever JavaScript"
 
"Forever {0}".format(["JavaScript"]);
// "Forever JavaScript"
 
"Forever {Java}".format({}, true);
// "Forever "
 
format("Forever {Python}", {Python: "JavaScript"});
// "Forever JavaScript"
 
format("Forever {0}", ["JavaScript"]);
// "Forever JavaScript"
 
format("Forever {Java}", {}, true);
// "Forever "

Documentation

format(string, table, HideIfNull)

Options

  • string

Type: string

  • table

Type: array & object

  • HideIfNull

Type: boolean

Tests

To run the test suite, first install the dependencies, then run test:

# NPM 
npm test
# Or Using Yarn 
yarn test

Dependencies

None

Contributors

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. List of all contributors.

License

MIT © TiagoDanin

Package Sidebar

Install

npm i jformat

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

4.55 kB

Total Files

4

Last publish

Collaborators

  • tiagodanin