@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
34 lines (31 loc) • 950 B
JavaScript
;
function transformScrollThresholdFix(root, j) {
let changed = false;
const renameIfMatch = p => {
const key = p.node.key;
const keyName =
key.type === 'Identifier' ? key.name :
(key.type === 'StringLiteral' || key.type === 'Literal') ? key.value :
null;
if (keyName === 'scrollTreshold') {
if (key.type === 'Identifier') {
key.name = 'scrollThreshold';
} else {
key.value = 'scrollThreshold';
if (key.extra) {
key.extra.rawValue = 'scrollThreshold';
if (key.extra.raw) {
key.extra.raw = key.extra.raw.replace('scrollTreshold', 'scrollThreshold');
}
}
}
changed = true;
}
};
root.find(j.ObjectProperty).forEach(renameIfMatch);
root.find(j.Property, n => !n.computed && !n.method && !n.shorthand).forEach(renameIfMatch);
return changed;
}
module.exports = {
transformScrollThresholdFix,
};