Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 8x 61x 61x 4x 57x 3x 3x 3x 1x 54x 8x | const { isDynamicKey, getStaticKey } = require('../utils/ast'); function listStaticKeys(callExpr, allKeys) { const { parentPath } = callExpr; if (parentPath.isMemberExpression()) { return isDynamicKey(parentPath) ? allKeys : [getStaticKey(parentPath)]; } if (parentPath.get('id').isObjectPattern()) { const properties = parentPath.get('id.properties'); const hasRestElement = properties.some(prop => prop.isRestElement()); if (hasRestElement) return allKeys; return properties.map(prop => prop.node.key.name); } return []; } module.exports = listStaticKeys; |