Skip to content

Commit

Permalink
fix: the lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
tx2002 committed Oct 28, 2024
1 parent ce76571 commit db748db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ function deepCopy(obj: Array<any> | any): any {

function customIn(a: number | string, b: number | string): number {
if ((b as any) instanceof Array) {
return (((b as any) as Array<any>).includes(a) as unknown) as number;
return (b as any as Array<any>).includes(a) as unknown as number;
}
return ((a in (b as any)) as unknown) as number;
return (a in (b as any)) as unknown as number;
}

function bracketCompatible(exp: string): string {
Expand Down
14 changes: 7 additions & 7 deletions test/enforcer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,9 @@ test('test ABAC multiple eval()', async () => {
);

const e = await newEnforcer(m, policy);
await testEnforce(e, 56, (98 as unknown) as string, 'read', true);
await testEnforce(e, 23, (67 as unknown) as string, 'read', false);
await testEnforce(e, 78, (34 as unknown) as string, 'read', false);
await testEnforce(e, 56, 98 as unknown as string, 'read', true);
await testEnforce(e, 23, 67 as unknown as string, 'read', false);
await testEnforce(e, 78, 34 as unknown as string, 'read', false);
});

// https://github.com/casbin/node-casbin/issues/438
Expand All @@ -617,10 +617,10 @@ test('test ABAC single eval() with r. in unexpected places', async () => {
);

const e = await newEnforcer(m, policy);
await testEnforce(e, { id: 3 }, ({ owner: { id: 3 } } as unknown) as string, 'read', true);
await testEnforce(e, {}, ({ owner: {} } as unknown) as string, 'read', false);
await testEnforce(e, { id: 3 }, ({ owner: {} } as unknown) as string, 'read', false);
await testEnforce(e, { id: 3 }, ({ owner: { id: 2 } } as unknown) as string, 'read', false);
await testEnforce(e, { id: 3 }, { owner: { id: 3 } } as unknown as string, 'read', true);
await testEnforce(e, {}, { owner: {} } as unknown as string, 'read', false);
await testEnforce(e, { id: 3 }, { owner: {} } as unknown as string, 'read', false);
await testEnforce(e, { id: 3 }, { owner: { id: 2 } } as unknown as string, 'read', false);
});

test('TestEnforceSync', async () => {
Expand Down

0 comments on commit db748db

Please sign in to comment.