New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mkconstants

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mkconstants

A utility function for recursively building an object of constants.

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source
mkconstants
===========

If you're building up a nested object of constants, for use with things like
facebook/Flux, it's handy to have a function that can process said object
and return something that can be compared upon. Also, namespaced on a per-
app basis.

So, for instance:

    mkconstants('ProductsApp', {
      ActionTypes: {
        Product: {
          RECEIVE_RAW_INSTANCE: null
        }
      },
      PayloadSources: {
        SERVER_ACTION: null,
        VIEW_ACTION: null
      }
    });

Would output:
  
    {
      ActionTypes: {
        Product: {
          RECEIVE_RAW_INSTANCE: 'ProductsApp.ActionTypes.Product.RECEIVE_RAW_INSTANCE'
        }
      },
      PayloadSources: {
        SERVER_ACTION: 'ProductsApp.PayloadSources.SERVER_ACTION',
        VIEW_ACTION: 'ProductsApp.PayloadSources.VIEW_ACTION'
      }
    }

These are not only unique, but also great for debugging purposes.

Keywords

FAQs

Package last updated on 17 Jul 2015

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