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.
20 lines
426 B
20 lines
426 B
4 years ago
|
'use strict';
|
||
|
|
||
|
var _require = require('../helpers/is'),
|
||
|
isFunction = _require.isFunction;
|
||
|
|
||
|
module.exports = function pull(key, defaultValue) {
|
||
|
var returnValue = this.items[key] || null;
|
||
|
|
||
|
if (!returnValue && defaultValue !== undefined) {
|
||
|
if (isFunction(defaultValue)) {
|
||
|
returnValue = defaultValue();
|
||
|
} else {
|
||
|
returnValue = defaultValue;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
delete this.items[key];
|
||
|
|
||
|
return returnValue;
|
||
|
};
|