Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
condition-flags-parser
Advanced tools
Parse/Apply JS like condition expressions on an object of flags
Parse/Apply JS-like condition expressions on an object of flags.
Easily apply a JS logic condition string based on an array of flags. E.g.: bunch of flags (traits) of a user fetched from a fast backend (e.g. redis). Requested entity requires a bunch of flags with some logic (and, or, threshold) to apply.
[
'countryFlag:NL',
'languageFlag:EN',
'proUser'
]
proUser && (countryFlag:NL || languageFlag:NL)
proUser + countryFlag:NL + languageFlag:NL + !optedOut > 2
&&
(and)||
(or)+
(add)-
(subtract)>
(gt)<
(lt)!
(not, e.g. flag does not apply, !someFlag
)a-z
A-Z
0-9
_
(underscore):
(colon).
(dot)a-z
or A-Z
.import { validate, flags, apply } from 'condition-flags-parser'
const condition = '(someFlag:123 + anotherFlag) + (countryFlag:NL + !countryFlag:GB) > 3'
// 2nd argument = throw Error in case of validation Error
// Boolean, true if valid, or Throws
console.log(validate(condition, true))
// List flags the condition is working with (for e.g. redis `smismember`)
console.log(flags(condition))
// Returns boolean (condition applies?)
console.log(apply(condition, [
'someFlag:123',
'countryFlag:NL',
'countryFlag:GB',
'anotherFlag',
]))
Tests: npm run test
FAQs
Parse/Apply JS like condition expressions on an object of flags
The npm package condition-flags-parser receives a total of 0 weekly downloads. As such, condition-flags-parser popularity was classified as not popular.
We found that condition-flags-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.