Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aswitalski/key-facsimile
A key-value mirror supporting prefixing, uppercase with underscore and lowercase with dash name convension.
https://github.com/aswitalski/key-facsimile
Last synced: 26 days ago
JSON representation
A key-value mirror supporting prefixing, uppercase with underscore and lowercase with dash name convension.
- Host: GitHub
- URL: https://github.com/aswitalski/key-facsimile
- Owner: aswitalski
- License: mit
- Created: 2015-11-03T00:26:52.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-09T09:23:11.000Z (about 9 years ago)
- Last Synced: 2024-11-14T11:09:42.415Z (about 2 months ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# key-facsimile
A key-value mirror supporting prefixing, uppercase with underscore and lowercase with dash name convension.[![Build Status](https://snap-ci.com/aswitalski/key-facsimile/branch/master/build_image)](https://snap-ci.com/aswitalski/key-facsimile/branch/master)
## Examples
#### Key mirror
``` js
import { keyMirror } from 'key-facsimile'
// or
// var keyMirror = require('key-facsimile');const Consts = keyMirror({
MOBILE: null,
TABLET: null,
DESKTOP: null
});console.log(Consts);
// prints { MOBILE: 'MOBILE', TABLET: 'TABLET', DESKTOP: 'DESKTOP' }
```#### Key lowercase conversion (with dashes)
``` js
import { keyLowercase } from 'key-facsimile'
// or
// var keyLowercase = require('key-facsimile').lowercase;const Classes = keyLowercase({
PRIMARY: null,
DISABLED: null,
HAS_FOCUS: null
});console.log(Classes);
// prints { PRIMARY: 'primary', DISABLED: 'disabled', HAS_FOCUS: 'has-focus' }
```#### Key uppercase conversion (with underscores)
``` js
import { keyUppercase } from 'key-facsimile'
// or
// var keyUppercase = require('key-facsimile').uppercase;const OS = keyUppercase({
'mac-os-x': null,
linux: null,
windows: null,
});console.log(OS);
// prints { 'mac-os-x': 'MAC_OS_X', linux: 'LINUX', windows: 'WINDOWS' }
```#### Key prefix
``` js
let keyPrefix = require('key-facsimile').prefix('MODE-');const Consts = keyPrefix({
MOBILE: null,
TABLET: null,
DESKTOP: null
});console.log(Consts);
// prints { MOBILE: 'MODE-MOBILE', TABLET: 'MODE-TABLET', DESKTOP: 'MODE-DESKTOP' }
```