Skip to content

Commit

Permalink
chore: fixes typo found in the key.ts file
Browse files Browse the repository at this point in the history
  • Loading branch information
petruki committed Dec 8, 2024
1 parent b74c668 commit 7522aa3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/lib/bypasser/criteria.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { StrategiesType } from '../snapshot.ts';

/**
* Criteria defines a set of conditions (when) that are used to evaluate the bypasser strategies
*/
export default class Criteria {
private readonly when: Map<string, string[]>;

Expand Down
12 changes: 6 additions & 6 deletions src/lib/bypasser/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Criteria from './criteria.ts';
export default class Key {
private readonly key: string;
private result: boolean;
private reaason?: string;
private reason?: string;
private metadata?: object;
private criteria?: Criteria;

Expand All @@ -20,7 +20,7 @@ export default class Key {
*/
true(): this {
this.result = true;
this.reaason = 'Forced to true';
this.reason = 'Forced to true';
return this;
}

Expand All @@ -29,7 +29,7 @@ export default class Key {
*/
false(): this {
this.result = false;
this.reaason = 'Forced to false';
this.reason = 'Forced to false';
return this;
}

Expand Down Expand Up @@ -57,7 +57,7 @@ export default class Key {
}

/**
* Return current value
* Return key response
*/
getResponse(input?: string[][]): {
result: boolean;
Expand All @@ -71,7 +71,7 @@ export default class Key {

return {
result,
reason: this.reaason,
reason: this.reason,
metadata: this.metadata,
};
}
Expand All @@ -80,7 +80,7 @@ export default class Key {
for (const [strategyWhen, inputWhen] of criteria.getWhen()) {
const entry = input.filter((e) => e[0] === strategyWhen);
if (entry.length && !inputWhen.includes(entry[0][1])) {
this.reaason = `Forced to ${!this.result} when: [${inputWhen}] - input: ${entry[0][1]}`;
this.reason = `Forced to ${!this.result} when: [${inputWhen}] - input: ${entry[0][1]}`;
return !this.result;
}
}
Expand Down

0 comments on commit 7522aa3

Please sign in to comment.