constant-mirror
v2.0.1
Published
A simple tool for creating objects with keys mirrored as values. Inspired by React's keyMirror.
Downloads
180
Maintainers
Readme
constant-mirror
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