
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
bacon.matchers
Advanced tools
Matcher library for Bacon.js.
You can map a Property / EventStream to a boolean
one like using .is()
// Returns a Property of Booleans
age.is().equalTo(65)
salary.is().greaterThan(1000)
You can also filter using .where()
// Returns a filtered stream
keyUps.map(".keyCode").where().equalTo(30)
And there's negation
age.is().not().greaterThan(18)
You can compare to either constant values or other Observables. Like
// Returns a Property of Booleans
var collision = playerPos.is().equalTo(monsterPos)
You can give field extractor strings to .where() and .is(), like this:
Bacon.fromArray([
{ name: "2001: A Space Odyssey", tags: ["SciFi"] },
{ name: "The Godfather", tags: ["Crime", "Drama"] },
]).where('.tags').containerOf("SciFi")
=> { name: "2001: A Space Odyssey", tags: ["SciFi"] }
Bacon.fromArray([
{ name: "2001: A Space Odyssey", tags: ["SciFi"] },
{ name: "The Godfather", tags: ["Crime", "Drama"] },
]).is('.tags.length').greaterThan(1)
=> false, true
Complete examples:
Bacon.fromArray([1,2,3]).is().equalTo(2)
=> false, true, false
Bacon.fromArray([1,2,3]).where().equalTo(2)
=> 2
Observable.is()
returns a Matchers
object for mapping to booleans.
Observable.where()
returns a Matchers
object for filtering.
lessThan(x)
applies <
matcher
lessThanOrEqualTo(x)
applies <=
matcher
greaterThan(x)
applies >
matcher
greaterThanOrEqualTo
applies >=
matcher
inClosedRange(a, b)
applies [a..b]
range matcher
inOpenRange(a, b)
applies (a..b)
range matcher
equalTo(x)
applies ==
matcher
truthy()
applies "truthy" matcher
match(expr)
applies regular expression
matcher
not()
returns a negated Matchers
object
containerOf(x)
and memberOf(x)
support arrays, strings and object key-values. Examples:
stream = Bacon.once([6]).is().containerOf(6) // is true
stream = Bacon.once(6).is().memberOf([6]) // is true
Bacon.once('hello bacon').is().containerOf('bacon') // is true
Bacon.once('bacon').is().memberOf('hello bacon') // is true
Bacon.once({
alien: 'morninglightmountain'
human: 'dudleybose'
}).is().containerOf({ alien: 'morninglightmountain' }) // is true
Bacon.once({ alien: 'morninglightmountain' })
.is().memberOf({
alien: 'morninglightmountain'
human: 'dudleybose'
}) // is true
some(fs...)
applies multiple "clauses", and matches when any clause is true.
Clauses are functions that map the observable to an observable of boolean values.
For example:
Bacon.once({ power_pill: true, ghosts: ["Inky", "Pinky"]})
.is()
.some(
function(stream){ return stream.is(".power_pill").truthy(); },
function(stream){ return stream.is(".ghosts").containerOf("Clyde"); }
) // is true
every(fs...)
applies multiple "clauses", and matches when all clauses are true.
For example:
Bacon.once({ power_pill: true, ghosts: ["Inky", "Pinky"]})
.is()
.every(
function(stream){ return stream.is(".power_pill").truthy(); },
function(stream){ return stream.is(".ghosts").containerOf("Clyde"); }
) // is false
IE 9 and above.
bacon.matchers
bacon.matchers
Tests are located in the spec directory. You can run them by installing dependencies with npm install
and then executing the run-tests
script.
FAQs
The best project ever.
We found that bacon.matchers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.