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
|
Line | |
---|
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 | */
|
---|
8 | function getFieldAsFn(field) {
|
---|
9 | return function getFromValue(value) {
|
---|
10 | return !!value && (typeof value === 'object') && (typeof value[field] === 'function') && value[field];
|
---|
11 | };
|
---|
12 | }
|
---|
13 |
|
---|
14 | module.exports = getFieldAsFn; |
---|
Note:
See
TracBrowser
for help on using the repository browser.