You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
444 B
22 lines
444 B
4 years ago
|
'use strict';
|
||
|
|
||
|
var _require = require('../helpers/is'),
|
||
|
isFunction = _require.isFunction;
|
||
|
|
||
|
module.exports = function get(key) {
|
||
|
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||
|
|
||
|
if (this.items[key] !== undefined) {
|
||
|
return this.items[key];
|
||
|
}
|
||
|
|
||
|
if (isFunction(defaultValue)) {
|
||
|
return defaultValue();
|
||
|
}
|
||
|
|
||
|
if (defaultValue !== null) {
|
||
|
return defaultValue;
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
};
|