How to use the lodash.isFunction function in lodash

To help you get started, we’ve selected a few lodash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / dgeni / lib / config.js View on Github external
configFilePath = path.resolve(configFilePath);

  log.info('Loading config %s', configFilePath);

  try {
    configModule = require(configFilePath);
  } catch(e) {
    if (e.code === 'MODULE_NOT_FOUND' && e.message.indexOf(configFilePath) !== -1) {
      throw new Error('File "'+ configFilePath + '" does not exist!');
    } else {
      throw new Error('Invalid config file!\n  ' + e.stack);
    }
  }

  if (!_.isFunction(configModule)) {
    throw new Error('Config file must export a function!\n' + CONFIG_SYNTAX_HELP);
  }

  // Provide a default basePath
  config.basePath = path.dirname(configFilePath);

  try {
    config = configModule(config);

    if ( ! (config instanceof Config) ) {
      throw new Error('Config file export function must return an instance of Config.\n' +
        'Instead it returned an object of type ' + config.constructor.name);
    }

    log.cli();
    log.level = config.get('logging.level', 'info');
github plouc / nivo / src / components / charts / Markers.js View on Github external
data,
            scales,
            xScale: _xScale,
            yScale: _yScale,
            width,
            height,
            color,
            x,
            y,
        } = this.props

        const xScale = scales[_xScale]
        const yScale = scales[_yScale]

        const getX = _.isFunction(x) ? x : d => d[x]
        const getY = _.isFunction(y) ? y : d => d[y]

        const rects = []
        data.forEach((d, i) => {
            let x
            let y
            let barWidth
            let barHeight

            if (xScale.bandwidth) {
                barWidth = xScale.bandwidth() // / series.length
                x = xScale(getX(d)) // + barWidth * serieIndex
            } else {
                x = 0
                barWidth = xScale(getX(d))
            }
github senecajs / seneca / lib / plugins.js View on Github external
if (v !== void 0) {
        var exportname = fullname + '/' + k
        seneca.private$.exports[exportname] = v
        exports.push(exportname)
      }
    })
  }

  // Specific Seneca extension points
  if (_.isObject(meta.extend)) {
    if (_.isFunction(meta.extend.action_modifier)) {
      seneca.private$.action_modifiers.push(meta.extend.action_modifier)
    }

    // FIX: needs to use logging.load_logger
    if (_.isFunction(meta.extend.logger)) {
      if (
        !meta.extend.logger.replace &&
        _.isFunction(seneca.private$.logger.add)
      ) {
        seneca.private$.logger.add(meta.extend.logger)
      } else {
        seneca.private$.logger = meta.extend.logger
      }
    }
  }

  return exports
}
github postmanlabs / postman-runtime / lib / _uvm / host.js View on Github external
NodeHost = function (sandbox, options, callback) {
    // account for polymorphic nature of options and callback
    if ((callback === undefined) && _.isFunction(options)) {
        callback = options;
        options = null;
    }

    if (!_.isFunction(callback)) { // be strict with the callback
        throw new Error('uvm.constructor() callback parameter missing.');
    }

    options = _.isObject(options) ? _.clone(options) : {};

    _.extend(this, {
        /**
         * @private
         * @type {Object.}
         */
        on: _.isObject(options.on) ? _.clone(options.on) : {},
github thorning / node-mailchimp / index.js View on Github external
Mailchimp.prototype.get = function (options, query, done) {
  options = _.clone(options) || {};

  if (_.isString(options)) {
    options = {
      path : options,
    }
  }
  options.method = 'get';

  if (!done && _.isFunction(query)) {
    done = query;
    query = null;
  }

  if (query && options.query) {
    console.warn('query set on request options overwritten by argument query');
  }

  if (query) {
    options.query = query;
  }

  return this.request(options, done);
}
github moleculerjs / moleculer / src / service-broker.js View on Github external
.then(() => {
				if (_.isFunction(this.options.stopped))
					return this.options.stopped(this);
			})
			.catch(err => {
github bcvsolutions / CzechIdMng / Realization / frontend / czechidm-core / src / components / basic / Table / LinkCell.js View on Github external
);
                    }).values()]
                  }
                
              }>
              {
                <button style="{{">{ propertyValue }</button>
              }
            
          }
        
        :
        <span>
          {
            _.isFunction(to)
            ?
            <a href="#">{propertyValue}</a>
            :
            
              {propertyValue}
            
          }
        </span>
      }
    
  );
};
github webiny / webiny-js / packages / webiny-client-ui / src / components / List / Components / Table / Actions / RouteAction.jsx View on Github external
getRoute() {
        return _.isFunction(this.props.route)
            ? this.props.route(this.props.data)
            : this.props.route;
    }
github rghorbani / react-native-common / src / screen-components / modal / index.js View on Github external
renderTouchableOverlay() {
    const {overlayBackgroundColor, onBackgroundPress} = this.props;
    if (_.isFunction(onBackgroundPress) || !!overlayBackgroundColor) {
      return (
        
      );
    }
  }