Skip to content

Commit

Permalink
chore: apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota committed Nov 6, 2024
1 parent 80f4edc commit 9406a6e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/tact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ jobs:
yarn clean
yarn gen
yarn build
# Test some specific things for backwards compatibility
# Test some specific things for backwards compatibility.
# It's important to restrain from using too much of Node.js 22+ features
# until it goes into maintenance LTS state and majority of users catches up
yarn jest -t 'isSubsetOf'
# Clean-up
yarn cleanall
Expand Down
2 changes: 1 addition & 1 deletion scripts/copy-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as glob from "glob";

const cp = async (fromGlob: string, toPath: string) => {
const files = glob.sync(fromGlob);
for await (const file of files) {
for (const file of files) {
await fs.copyFile(file, path.join(toPath, path.basename(file)));
}
};
Expand Down
3 changes: 1 addition & 2 deletions src/utils/isSubsetOf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ function createSetLike<T>(elements: T[]): ReadonlySetLike<T> {
}

function includes<T>(target: T[], wanted: T) {
for (const element of target) if (wanted === element) return true;
return false;
return target.some((element) => element === wanted);
}

function createIterator<T>(elements: T[]): Iterator<T> {
Expand Down
3 changes: 1 addition & 2 deletions src/utils/isSubsetOf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export function isSubsetOf<T>(
other: ReadonlySetLike<unknown>,
): boolean {
// If the builtin method exists, just call it
/* eslint-disable @typescript-eslint/no-explicit-any */
if ((Set.prototype as any).isSubsetOf) {
if ("isSubsetOf" in Set.prototype) {
return one.isSubsetOf(other);
}
// If not, provide the implementation
Expand Down

0 comments on commit 9406a6e

Please sign in to comment.