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.
Ruby style ES5 prototype extensions
A highly experimental set of prototype extensions for native types in ES5 JavaScript.
Using npm.
npm install rubyisms
Full list of methods here.
Object.prototype
Rubyisms defines properties on Object.prototype
. A side effect is the creation of globally scoped constants. The following should be treated as reserved keywords in the global scope, and are not writable.
array
bool
func
numeric
object
size
type
Everything created will contain these as prototype properties. To override these properties on objects you must define them during construction, or explicitly define them with Object.defineProperty
.
No good.
var o = {};
o.size = 5 // Will not write
o.size // 0
function Constructor () {
this.size = 5; // Will not write
}
new Constructor().size // 0
Better.
var o = {size: 5};
o.size // 5
function Constructor () {
Object.defineProperty(this, 'size', {
value: 5,
writable: true
});
}
new Constructor().size // 5
.type
Return values from calling .type
on the global object will differ. In V8 (Chrome, Node), the return string is 'global'
, whereas in other browsers it is 'window'
.
FAQs
Ruby style ES5 prototype extensions.
The npm package rubyisms receives a total of 2 weekly downloads. As such, rubyisms popularity was classified as not popular.
We found that rubyisms 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
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.