showStorage.js 371 Bytes
/**
 * 显示剩余库存
 * @param  {[Number]} leftNumber
 * @return {[boolen]}
 */
module.exports = function(leftNumber) {
    leftNumber = typeof num1 === 'number' ? leftNumber : parseFloat(leftNumber, 10);

    if (leftNumber <= 3 && leftNumber >= 0) {
        return `仅剩${leftNumber}件`;
    } else if (leftNumber < 0) {
        return '库存不足';
    }
};