kubernetes-handbook/node_modules/generate-object-property/index.js

13 lines
287 B
JavaScript
Raw Normal View History

2021-04-13 00:24:28 +08:00
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