(obj)
| 4 | const camelCase = require('camel-case') |
| 5 | |
| 6 | function normalize(obj) { |
| 7 | if(typeof obj === 'string') { |
| 8 | obj = {type: obj, default: null, doc: ''} |
| 9 | } else { |
| 10 | // assert.equal(typeof obj, 'object') |
| 11 | if(obj.default == null) { |
| 12 | obj.default = null |
| 13 | } |
| 14 | if(obj.doc == null) { |
| 15 | obj.doc = '' |
| 16 | } |
| 17 | // if(obj.type === undefined) { |
| 18 | // obj.type = null |
| 19 | // } |
| 20 | } |
| 21 | |
| 22 | obj.optional = /\?$/.test(obj.type) // ends in ? |
| 23 | if(obj.optional) { |
| 24 | obj.type = obj.type.substring(0, obj.type.length - 1) // remove ? |
| 25 | } |
| 26 | if(/\[\]$/.test(obj.type)) { // asset[] |
| 27 | obj.type = `Array<${obj.type.substring(0, obj.type.length - 2)}>` |
| 28 | } else { |
| 29 | obj.type = obj.type.replace('[', '<').replace(']', '>') //set<public_key> |
| 30 | } |
| 31 | return obj |
| 32 | } |
| 33 | |
| 34 | function out(str = '') { |
| 35 | console.log(str.trim()) |
no outgoing calls
no test coverage detected