fd22b0bf58
V2 (Laravel re-make)
20 lines
426 B
JavaScript
Vendored
20 lines
426 B
JavaScript
Vendored
'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;
|
|
}; |