Dashboard sipadu mbip
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

get-field-as-fn.js 483B

1234567891011121314
  1. 'use strict';
  2. /**
  3. * Create a method that will retrieve the given field from an object where that field has a function value
  4. * @param {string} field The field to consider
  5. * @returns {function(object):function} A method that gets functions from the given field
  6. */
  7. function getFieldAsFn(field) {
  8. return function getFromValue(value) {
  9. return !!value && (typeof value === 'object') && (typeof value[field] === 'function') && value[field];
  10. };
  11. }
  12. module.exports = getFieldAsFn;