keyf
key formatter based on a function's arguments
Last updated 12 years ago by ktmud .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm 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 (12 years ago)

2 Versions

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

Copyright 2013 - present © cnpmjs.org | Home |