• This project
    • Loading...
  • Sign in

fe / yohobuywap-node · Files

Go to a project

GitLab

  • Go to group
  • Project
  • Activity
  • Files
  • Commits
  • Pipelines 0
  • Builds 0
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Members
  • Labels
  • Wiki
  • Forks
  • Network
  • Create a new issue
  • yohobuywap-node
  • public
  • js
  • common
  • helpers
  • ifor.js
  • 50%完成
    b3d97479
    by 陈峰
    2017-03-21 14:18:02 +0800  
    Browse Files
ifor.js 433 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/**
 * or 条件判断
 * @param string value
 */
module.exports = function() {
    let args = Array.prototype.slice.call(arguments);
    let opt = args[args.length - 1];
    let isTrue = false;

    for (let i = 0; i < args.length - 1; i++) {
        if (args[i]) {
            isTrue = true;
            break;
        }
    }

    if (isTrue) {
        return opt.fn(this);
    } else {
        return opt.inverse(this);
    }
};