Socket
Socket
Sign inDemoInstall

native-constants

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    native-constants

A light-weight library to access unpolluted Native Constants in JavaScript


Version published
Weekly downloads
1
Maintainers
1
Install size
8.42 kB
Created
Weekly downloads
 

Readme

Source

native-constants.js

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).

Usage

// 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 "{}"

Installation

native-constants.js is just 437 bytes minified & gzipped.

  • Bower: bower install native-constants
  • NPM: npm install native-constants
  • Download zip.

Note: native-constants.js supports AMD and commonJS module pattern out of the box.

Browser Support

native-constants.js works amazingly on all browsers.

Contributing

Interested in contributing features and fixes?

Read more on contributing.

Changelog

See the Changelog

License

Copyright (c) 2015 Apoorv Saxena, http://apoorv.pro Licensed under the MIT license.

Keywords

FAQs

Last updated on 21 Dec 2015

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc