Huáng Jùnliàng 5e4b85ab1c
refactor: move @babel/helper-get-function-arity to ts (#12414)
* refactor: move @babel/helper-get-function-arity to ts

* Review comments

* chore: add flow interface
2020-12-01 10:45:05 -05:00

13 lines
310 B
TypeScript

import * as t from "@babel/types";
export default function (node: t.Function): number {
const params = node.params;
for (let i = 0; i < params.length; i++) {
const param = params[i];
if (t.isAssignmentPattern(param) || t.isRestElement(param)) {
return i;
}
}
return params.length;
}