express-fix-any-js 1.8.2 → 1.8.3

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.
package/bin/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import getLatestVersion from "./core/getLatestVersion.js";
4
4
  import loadRunner from "./core/loadRunner.js";
@@ -4,7 +4,8 @@ const startFunc = ({
4
4
  toInsertLine,
5
5
  insertAfter
6
6
  }) => {
7
- const before = content.slice(0, insertInfo.index);
7
+ const index = insertInfo.index === -1 ? content.length : insertInfo.index;
8
+ const before = content.slice(0, index);
8
9
 
9
10
  const isFirstInsert =
10
11
  insertInfo.matchedPattern === insertAfter[insertAfter.length - 1];
@@ -14,14 +15,14 @@ const startFunc = ({
14
15
  (isFirstInsert ? "\n" : "") +
15
16
  toInsertLine.join("\n") +
16
17
  "\n" +
17
- content.slice(insertInfo.index);
18
+ content.slice(index);
18
19
  }
19
20
 
20
21
  return before +
21
22
  (isFirstInsert ? "\n" : "") +
22
23
  toInsertLine +
23
24
  "\n" +
24
- content.slice(insertInfo.index);
25
+ content.slice(index);
25
26
  };
26
27
 
27
28
  export default startFunc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-fix-any-js",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "CLI to build for appjs, the endpoints",
5
5
  "keywords": [
6
6
  "cli",