Skip to content

Commit 90cd625

Browse files
authored
perf: move some responsibilities out of recursive function (#17)
* perf: move checks out of recursive function call restructures responsibilities to the reduce count of some checks improves performance and reduce bundle size * perf(validation): drop custom integer validation drops integer validation in favour of inbuilt js array length checks * refactor: rename variable for clarity * refactor: refactor top-level conditional
1 parent a7c702a commit 90cd625

File tree

5 files changed

+97
-118
lines changed

5 files changed

+97
-118
lines changed

.github/workflows/setup-node-and-test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ jobs:
4848
run: npm run build
4949
- name: validate build
5050
run: |
51-
FILE=lib/index.js
52-
FILE2=lib/index.d.ts
53-
if [ -f $FILE ] && [ -f $FILE2 ]; then echo "Files exist"
54-
else echo "Files do not exist" && exit 1
55-
fi
51+
FILE=lib/index.js
52+
FILE2=lib/index.d.ts
53+
if [ -f $FILE ] && [ -f $FILE2 ]; then echo "Files exist"
54+
else echo "Files do not exist" && exit 1
55+
fi
5656
- name: lint
5757
run: npm run lint
5858
- name: test
@@ -68,4 +68,4 @@ jobs:
6868
id: benchmark
6969
run: npm run benchmark:diff:ci
7070
env:
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

benchmark/run-benchmark.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ benny
7878
["new", "old", "delta"]
7979
);
8080

81-
if (!isInCI) {
81+
if (!isInCI || !process.env.GITHUB_TOKEN) {
8282
return;
8383
}
8484

@@ -89,8 +89,7 @@ benny
8989
body += `| ${diff.name} | ${diff.new}| ${diff.old} | ${diff.delta} |\n`;
9090
});
9191

92-
const octokit = getOctokit(process.env.GITHUB_TOKEN ?? "");
93-
await octokit.rest.issues.createComment({
92+
await getOctokit(process.env.GITHUB_TOKEN).rest.issues.createComment({
9493
issue_number: context.issue.number,
9594
owner: context.repo.owner,
9695
repo: context.repo.repo,

0 commit comments

Comments
 (0)