abcnews/alternating-case-to-object

Name: alternating-case-to-object

Owner: ABC News

Description: Convert an alternating cased string to a JSON object

Created: 2017-09-26 04:26:29.0

Updated: 2017-09-26 06:17:02.0

Pushed: 2017-10-02 01:36:47.0

Homepage: null

Size: 35

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Alternating Case to Object

A function to convert ALTERNATINGcase strings to objects.

Usage
t alternatingCaseToObject = require('alternating-case-to-object');

rnatingCaseToObject('PROPvalueSECONDthingALLOWEDyesTHINGS100');

>>


op: 'value',
cond: 'thing',
lowed: true,
ings: 100

Automatic type inference
rnatingCaseToObject('GROUPfirstGROUPsecondGROUPthird');

>>


oup: ['first', 'second', 'third'];

Options

You can pass an object as a second argument, defining one or more options:

arrayProps:Array

Props in this array will always be returned as arrays, even if they occur in the config string zero or one time.

rnatingCaseToObject('AtrueA100BvalueAvalueDvalue', {
rayProps: ['a', 'b', 'c']


>>


 [true, 100, 'value'],
 ['value'],
 [],
 'value'

propMap:Object

Props in the config will be renamed if they occur in this object.

rnatingCaseToObject('CAMELCASEtrueKEBABCASE100', {
opMap: {
camelcase: 'camelCase',
kebabcase: 'kebab-case'



>>


melCase: true,
ebab-case': 100


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.