2018-07-01 23:50:42 +00:00
|
|
|
module.exports = {
|
|
|
|
/**
|
|
|
|
* Get default value of type
|
|
|
|
*
|
2018-07-08 05:12:43 +00:00
|
|
|
* @param {any} type primitive type name
|
2018-07-01 23:50:42 +00:00
|
|
|
* @returns Default value
|
|
|
|
*/
|
2018-07-08 05:12:43 +00:00
|
|
|
getTypeDefaultValue (type) {
|
|
|
|
switch (type.toLowerCase()) {
|
|
|
|
case 'string':
|
|
|
|
return ''
|
|
|
|
case 'number':
|
|
|
|
return 0
|
|
|
|
case 'boolean':
|
|
|
|
return false
|
2018-07-01 23:50:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|