mirror of
https://github.com/flarum/framework.git
synced 2024-12-05 00:43:39 +08:00
16 lines
394 B
JavaScript
16 lines
394 B
JavaScript
|
/**
|
||
|
* The `extract` utility deletes a property from an object and returns its
|
||
|
* value.
|
||
|
*
|
||
|
* @param {Object} object The object that owns the property
|
||
|
* @param {String} property The name of the property to extract
|
||
|
* @return {*} The value of the property
|
||
|
*/
|
||
|
export default function extract(object, property) {
|
||
|
const value = object[property];
|
||
|
|
||
|
delete object[property];
|
||
|
|
||
|
return value;
|
||
|
}
|