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.

21 lines
444 B

4 years ago
  1. 'use strict';
  2. var _require = require('../helpers/is'),
  3. isFunction = _require.isFunction;
  4. module.exports = function get(key) {
  5. var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  6. if (this.items[key] !== undefined) {
  7. return this.items[key];
  8. }
  9. if (isFunction(defaultValue)) {
  10. return defaultValue();
  11. }
  12. if (defaultValue !== null) {
  13. return defaultValue;
  14. }
  15. return null;
  16. };