
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
native-constants
Advanced tools
A light-weight library to access unpolluted Native Constants in JavaScript
Access unpolluted Native Constants in JavaScript
native-constants.js is a light-weight library to access unpolluted Native Constants in JavaScript.
It is written with an aim to allow access to unpolluted native constants which are often polluted by page owners(in case you are loading your script on someone else's page) or third party scripts(in case you are a page owner).
// May God have mercy on the devil that wrote this code
JSON = "foo"
// Output as it shouldn't be
console.log(JSON.stringify({})); // Uncaught TypeError: JSON.stringify is not a function
// Use Native Constants Library on the same webpage
// Here's the call to your angel
var JSON = NativeConstants.get('JSON')
// Output as it should be
console.log(JSON.stringify({})); // outputs "{}"
native-constants.js is just 437 bytes minified & gzipped.
bower install native-constants
npm install native-constants
Note: native-constants.js supports AMD and commonJS module pattern out of the box.
native-constants.js works amazingly on all browsers.
Interested in contributing features and fixes?
See the Changelog
Copyright (c) 2015 Apoorv Saxena, http://apoorv.pro Licensed under the MIT license.
FAQs
A light-weight library to access unpolluted Native Constants in JavaScript
The npm package native-constants receives a total of 0 weekly downloads. As such, native-constants popularity was classified as not popular.
We found that native-constants 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.