keyf
key formatter based on a function's arguments
Last updated 11 years ago by ktmud .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install keyf 
SYNC missed versions from official npm registry.

keyf

Key formatter for function arguments

Usage

var keyf = require('keyf')
var formatter = keyf('some-prefix:{_abc_}:{0}:{this.foo}:{1.bar}', {
  '_abc_': 'pre-defined-value'
})

User.prototype.foo = 'abc'

User.prototype.cacheKey = function() {
 return formatter.call(this, arguments)
}
var user = new User()

user.cacheKey(1, { bar: '2' })
// -> some-prefix:pre-defined-value:1:abc:2

License

the MIT license.

Current Tags

  • 0.0.2                                ...           latest (11 years ago)

2 Versions

  • 0.0.2                                ...           11 years ago
  • 0.0.1                                ...           11 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE