'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;
|
|
};
|