constant-mirror

2.0.1 • Public • Published

constant-mirror npm npm

A simple tool for creating objects with keys mirrored as values. Inspired by React's keyMirror.

Install

npm install --save constant-mirror

Usage

// ES6
import mirror from 'constant-mirror';
// or ES5
var mirror = require('constant-mirror');
 
mirror('HELLO', 'WORLD');
// => { HELLO: 'HELLO', WORLD: 'WORLD' }

Symbol Mirror

// ES6
import mirror from 'constant-mirror/lib/symbol';
// or ES5
var mirror = require('constant-mirror/lib/symbol');
 
mirror('HELLO', 'WORLD');
// => { HELLO: Symbol(HELLO), WORLD: Symbol(WORLD) }

License

MIT © Griffin Yourick

Package Sidebar

Install

npm i constant-mirror

Weekly Downloads

18

Version

2.0.1

License

MIT

Unpacked Size

5.76 kB

Total Files

5

Last publish

Collaborators

  • tough-griff