我是JSCodeshift的新手。在以下情况下,我需要在文件中查找名称为isLengthOfNum的方法,如果length = 0,则需要插入方法isLengthOfNum。
isLengthOfNum的方法定义-
isLengthOfNum = () => {
this.dispatchStoreAction(ActionTypes.CART_SET_ADDITIONAL_DATA, additionalData);
}
要搜索和转换的文件代码-
//import statements
export default class example extends baseClass{
constructor(store) {
super(store);
}
clear = (frrfe) => {
//Some Actions
}
}
收件人
//import statements
export default class example extends baseClass{
constructor(store) {
super(store);
}
clear = (frrfe) => {
//Some Actions
}
isLengthOfNum = (additionalData) => {
this.dispatchStoreAction(ActionTypes.SET_ADDITIONAL_DATA, additionalData);
}
}
建议一种方法。