UNPKG

charlike

Version:

Small, fast, simple and streaming project scaffolder for myself, but not only. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options

17 lines (15 loc) 475 B
import assign from 'object-assign'; import getValue from './index'; /** * Extractor function for an ObjectExpression type value node. * An object expression is using {}. * * @returns - a representation of the object */ export default function extractValueFromObjectExpression(value) { return value.properties.reduce((obj, property) => { const object = assign({}, obj); object[getValue(property.key)] = getValue(property.value); return object; }, {}); }