Skip to content

Conversation

HashCookie
Copy link
Contributor

@casbin-bot
Copy link
Member

@nodece @Shivansh-yadav13 please review

const key = line.substring(0, equalIndex);
const value = line.substring(equalIndex + 1);
this.addConfig(section, key.trim(), value.trim());
const key = line.substring(0, equalIndex).trim();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract all grammar checking code into a "validator"


// Verify operator in matcher
public static validateMatcherOperators(value: string): void {
const invalidOperators = /(?<![&|])&(?!&)|(?![&|])\|(?!\|)|&{3,}|\|{3,}/g;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is using same RegExp as validateMatcher, without any reference but just as a copy - that potentially could cause a mistake in future (when RegExp will be changed in one place, but not both).

Also this kind of RegExp (especialy LookBehind) has limited support on a not so old browsers like iOS 16 (<16.4), that could lead developers to patching casbin to use with such browsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants