Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

test function that call a function javascrip

var _ = require('lodash');

var Foo = module.exports = function (config) {

  this.config = _.merge({
      role: 'user',
      x: '123',
      y: '321'
    },
    config);

  this.config.role = validateRole(this.config.role);
};

var validateRole = function (role) {
  var roles = [
    'user', 'editor', 'admin'
  ];

  if (_.contains(roles, role)) {
    return role;
  } else {
    return 'user'
  }
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #test #function #call #function #javascrip
ADD COMMENT
Topic
Name
4+3 =