12 lines
287 B
JavaScript
12 lines
287 B
JavaScript
var isProperty = require('is-property')
|
|
|
|
var gen = function(obj, prop) {
|
|
return isProperty(prop) ? obj+'.'+prop : obj+'['+JSON.stringify(prop)+']'
|
|
}
|
|
|
|
gen.valid = isProperty
|
|
gen.property = function (prop) {
|
|
return isProperty(prop) ? prop : JSON.stringify(prop)
|
|
}
|
|
|
|
module.exports = gen
|