MCPcopy Create free account
hub / github.com/ampproject/amphtml / isReferenceToObjectKeyList

Function isReferenceToObjectKeyList

build-system/compile/json-schema/index.js:239–263  ·  view source on GitHub ↗

* @param {babel.NodePath} path * @return {boolean}

(path)

Source from the content-addressed store, hash-verified

237 * @return {boolean}
238 */
239 function isReferenceToObjectKeyList(path) {
240 const {parentPath} = path;
241 if (parentPath?.isMemberExpression() && path.key === 'object') {
242 return (
243 t.isIdentifier(parentPath.node.property, {name: 'hasOwnProperty'}) &&
244 parentPath.parentPath?.isCallExpression()
245 );
246 }
247 if (
248 parentPath?.isCallExpression() &&
249 parentPath.node.arguments[0] === path.node
250 ) {
251 const callee = parentPath.get('callee');
252 return (
253 isMemberExpressionLeftwards(callee, ['Object', 'keys']) ||
254 isMemberExpressionLeftwards(callee, [
255 'Object',
256 'prototype',
257 'hasOwnProperty',
258 'call',
259 ])
260 );
261 }
262 return false;
263 }
264
265 /** @type {{[stringified: string]: string}} */
266 const valueReferences = {};

Callers

nothing calls this directly

Calls 2

getMethod · 0.45

Tested by

no test coverage detected