Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
fairmont-multimethods
Advanced tools
Fairmont-Multimethods is a JavaScript library providing support for multimethods in JavaScript.
npm i -S fairmont-multimethods
equal = Method.create
description: "'Deep' equality operator"
default: (a, b) -> a == b # fallback to shallow equality
# when comparing objects, recursively check the values
# corresponding to the union of their properties—
# return false on the first inequality
Method.define equal, isObject, isObject, (a, b) ->
(a == b) || do ->
keys = new Set (Object.keys a)..., (Object.keys b)...
for key from keys
if ! equal a[key], b[key]
return false
true
# when comparing arrays, recursively check values
# after making sure they're the same length
# return false on the first inequality
Method.define equal, isArray, isArray, (ax, bx) ->
(ax == bx) || do ->
return false if ax.length != bx.length
for i in [0..ax.length]
if !equal ax[i], bx[i]
return false
true
equal "this", "this" # => true, shallow equality works here
equal { x: 1, y: 2 }, { x: 1, y: 2 } # => true, deep equality
equal [1..5], [1..5] # true, deep equality
equal { x: 1, y: 2}, [1..5] # false
FAQs
Multi-argument dispatch for JavaScript functions
The npm package fairmont-multimethods receives a total of 2,118 weekly downloads. As such, fairmont-multimethods popularity was classified as popular.
We found that fairmont-multimethods demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.