index.js 568 Bytes
/**
 * Handlebars helpers
 * dongjinhu jinhu.dong@yoho.cn
 * 2016-07-14
 */

'use strict';

/**
 * 乘法
 * @param  {[Number]} num1
 * @param  {[Number]} num2
 * @param  {[object]} options 上下文环境,一般不手动传
 * @return {[boolen]}
 */
exports.multiple = (num1, num2) => {
    num1 = typeof num1 === 'number' ? num1 : parseFloat(num1, 10);
    num2 = typeof num2 === 'number' ? num2 : parseFloat(num2, 10);

    if (num1 && num2) {
        return num1 * num2;
    } else {
        console.error('multiplication needs two number parameters');
    }
};