This repository has been archived on 2026-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
todo/client/node_modules/adjust-sourcemap-loader/lib/process/get-field-as-fn.js

14 lines
483 B
JavaScript
Raw Normal View History

2025-06-13 06:04:40 +00:00
'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;