UNPKG

@writ/utils

Version:
13 lines (11 loc) 230 B
'use strict'; /** * 任意对象转整型 * @param {Object} n 任意对象 * @return {Number} 返回整数 */ function toInt(n) { var num = parseInt(n, 10); return isNaN(num) ? 0 : num; } module.exports = toInt;