source: trip-planner-front/node_modules/adjust-sourcemap-loader/lib/process/get-field-as-fn.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 483 bytes
RevLine 
[6a3a178]1'use strict';
2
3/**
4 * Create a method that will retrieve the given field from an object where that field has a function value
5 * @param {string} field The field to consider
6 * @returns {function(object):function} A method that gets functions from the given field
7 */
8function getFieldAsFn(field) {
9 return function getFromValue(value) {
10 return !!value && (typeof value === 'object') && (typeof value[field] === 'function') && value[field];
11 };
12}
13
14module.exports = getFieldAsFn;
Note: See TracBrowser for help on using the repository browser.