my-idlers/node_modules/collect.js/dist/methods/pull.js
cp6 fd22b0bf58 V2 (Laravel re-make)
V2 (Laravel re-make)
2022-03-06 02:02:12 +11:00

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