UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

27 lines (22 loc) 586 B
'use strict'; function transformModelIdCalls(root, j) { let changed = false; root.find(j.CallExpression) .filter(path => { const callee = path.value.callee; return ( j.MemberExpression.check(callee) && j.Identifier.check(callee.property) && callee.property.name === 'id' && path.value.arguments.length === 0 ); }) .forEach(path => { path.replace(j.memberExpression(path.value.callee.object, j.identifier('id'))); changed = true; }); return changed; } module.exports = { transformModelIdCalls, };