
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Make an object immutable, and allow it to be called as a function to check if it contains a specific value.
Make an object immutable, and allow it to be called as a function to check if it contains a specific value.
// Require the function
const quickEnum = require('quick-enum')
// Call with an object to create a quick-enum
const MY_ENUM = quickEnum({ FOO: "bar" })
// Check the value of one of the properties...
console.log(MY_ENUM.FOO) // => "bar"
// Try to set a new value...
console.log(MY_ENUM.FOO = "sjallot") //
// Realize it doesn't work, because enum.
console.log(MY_ENUM.FOO) // => "bar" (Still)
// Check if "bar" is one of the values...
console.log(MY_ENUM("bar")) // => true
// Check if "sjallot" is one of the values...
console.log(MY_ENUM("sjallot")) // => false
Setting a value after instantiation, will set the value, and it won't be immutable. This could be solvable with Proxy Objects as shown here: https://gist.github.com/jansabbe/fc91b6d9f44770783112 however according to a benchmark here: http://thecodebarbarian.com/thoughts-on-es6-proxies-performance that would be quite a bit slower.
After being asked a question about Enums in Javascript, I took it as a challenge to create a simple, elegant and quick way to create an Enum-like thing which would
After being told to nevermind, I didn't want to let go of the challenge that easily... And so, after a few minutes this was born. The quick-enum. :D
FAQs
Make an object immutable, and allow it to be called as a function to check if it contains a specific value.
We found that quick-enum 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.