spice
No-frills string interpolation library.
Last updated 7 years ago by killdream .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install spice 
SYNC missed versions from official npm registry.

Spice

No-frills string interpolation library.

var spice = require('spice')
spice('Hello, {:subject}!', { subject: 'world' })
// => (string) "Hello, world!"

Or, alternatively, mess with the String#prototype:

var spice = require('spice')
String.prototype.format = function(mappings) {
  return spice(this, mappings)
}

'Hello, {:subject}!'.format({
  subject: 'world'
})
// => (string) "Hello, world!"

Installing

Just grab it from NPM for the easy-modo install:

$ npm install spice
# Then require it as usual
node> var spice = require('spice')

Testing

The test cases uses Mocha, Noire and Sinon. Just grab everything from NPM and run the test-cases by issuing mocha from the command line:

$ npm install -g mocha
$ npm install --dev    # To grab the testing dependencies
$ npm install sinon    # It's not listed in --dev because C++ deps
$ npm run-script test

Licence

Spice is licensed under the delicious and permissive MIT licence. You can happily copy, share, modify, sell or whatever — refer to the actual licence text for less information:

$ less LICENCE

Current Tags

  • 1.0.2                                ...           latest (7 years ago)

5 Versions

  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (4)

Copyright 2014 - 2016 © taobao.org |