1.0.2 • Published 7 years ago

app-defines v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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!

1.0.2

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago