Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

app-defines

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-defines

Define immutable app-wide constants

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

app-defines

npm version npm license travis build

const defines = require('app-defines');

// Set all defines once for the lifetime of the process
defines.someConstant = 42;
defines.someOtherConstant = {luck: 'good'};

// Finalize the defines
defines.freeze();

// Defines are now irreversibly read-only (including nested properties)
defines.someOtherProperty.luck = 'bad'; // Throws TypeError

// The read-only defines object can now be required from anywhere in the app

The object is frozen with the technique used in deep-freeze.

This module is rather trivial, but useful to have as an external module, so that the defines can be required from any file in the project without the need of relative requires.

This module is intended for use in application code only and should not be used in dependencies!

FAQs

Package last updated on 22 Jul 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc