mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-29 02:49:15 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
24
web/node_modules/jsx-ast-utils/src/values/expressions/ObjectExpression.js
generated
vendored
Normal file
24
web/node_modules/jsx-ast-utils/src/values/expressions/ObjectExpression.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
import assign from 'object.assign';
|
||||
|
||||
/**
|
||||
* Extractor function for an ObjectExpression type value node.
|
||||
* An object expression is using {}.
|
||||
*
|
||||
* @returns - a representation of the object
|
||||
*/
|
||||
export default function extractValueFromObjectExpression(value) {
|
||||
// eslint-disable-next-line global-require
|
||||
const getValue = require('./index.js').default;
|
||||
return value.properties.reduce((obj, property) => {
|
||||
const object = { ...obj };
|
||||
// Support types: SpreadProperty and ExperimentalSpreadProperty
|
||||
if (/^(?:Experimental)?Spread(?:Property|Element)$/.test(property.type)) {
|
||||
if (property.argument.type === 'ObjectExpression') {
|
||||
return assign(object, extractValueFromObjectExpression(property.argument));
|
||||
}
|
||||
} else {
|
||||
object[getValue(property.key)] = getValue(property.value);
|
||||
}
|
||||
return object;
|
||||
}, {});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue