Sha256: e13cddbf494fb3a660cda64bdadc0542c0b26705bcecba7e17c4a201fd7b086d

Contents?: true

Size: 483 Bytes

Versions: 4

Compression:

Stored size: 483 Bytes

Contents

'use strict';

/**
 * Create a method that will retrieve the given field from an object where that field has a function value
 * @param {string} field The field to consider
 * @returns {function(object):function} A method that gets functions from the given field
 */
function getFieldAsFn(field) {
  return function getFromValue(value) {
    return !!value && (typeof value === 'object') && (typeof value[field] === 'function') && value[field];
  };
}

module.exports = getFieldAsFn;

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/adjust-sourcemap-loader/lib/process/get-field-as-fn.js
optimacms-0.4.3 spec/dummy/node_modules/adjust-sourcemap-loader/lib/process/get-field-as-fn.js
optimacms-0.4.2 spec/dummy/node_modules/adjust-sourcemap-loader/lib/process/get-field-as-fn.js
cortex-0.1.3 spec/dummy/node_modules/adjust-sourcemap-loader/lib/process/get-field-as-fn.js