js-code-detector 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -167,15 +167,15 @@ var _AstUtil = class {
167
167
  if (node.body && this.isBodyArray(node.body)) {
168
168
  const { body } = node.body;
169
169
  body.forEach((cur) => {
170
- if (node.type === "FunctionDeclaration" || node.type === "ClassDeclaration") {
171
- const id = node.id;
170
+ if (cur.type === "FunctionDeclaration" || cur.type === "ClassDeclaration") {
171
+ const id = cur.id;
172
172
  if (id) {
173
173
  holdingIds.add(id);
174
174
  id._util.variableScope = [id];
175
175
  id._util.holdingIdType = node.type === "ClassDeclaration" ? "Class" : "Function";
176
176
  }
177
- } else if (node.type === "VariableDeclaration") {
178
- this.findIdOfVariable(node, (id) => {
177
+ } else if (cur.type === "VariableDeclaration") {
178
+ this.findIdOfVariable(cur, (id) => {
179
179
  holdingIds.add(id);
180
180
  id._util.variableScope = [id];
181
181
  id._util.holdingIdType = "Variable";
@@ -570,8 +570,13 @@ var _AstUtil = class {
570
570
  if (id.type === "ObjectPattern") {
571
571
  const properties = id.properties;
572
572
  for (const property of properties) {
573
- const value = property.value;
574
- this._deepFindIdentifier(value, callback);
573
+ if (property.type === "Property") {
574
+ const value = property.value;
575
+ this._deepFindIdentifier(value, callback);
576
+ } else if (property.type === "RestElement") {
577
+ const argument = property.argument;
578
+ this._deepFindIdentifier(argument, callback);
579
+ }
575
580
  }
576
581
  }
577
582
  if (id.type === "ArrayPattern") {
@@ -32,7 +32,7 @@ export declare function createDetectReport(arg: Arg): {
32
32
  effects: string[];
33
33
  }[];
34
34
  }[];
35
- type: "delete" | "modify" | "add";
35
+ type: "delete" | "add" | "modify";
36
36
  filesDependsOnMe: string[][];
37
37
  undefinedIdentifiers: string[];
38
38
  dangerIdentifiers: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-code-detector",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",