Writing code

FUNCTION

toParameterVariable

@skmtc/lang-typescript 0.19.1

Names the variable that holds an operation parameter in generated code.

A name that is not an identifier is camel-cased, and a reserved word gains the suffix sanitizeIdentifier gives it. Two names can give one variable (a-b and aB).

Signature

import { toParameterVariable } from '@skmtc/lang-typescript'

toParameterVariable(name: string): string

Parameters

name, string required
Example
toParameterVariable('user_id')         // 'user_id'
toParameterVariable('enterprise-team') // 'enterpriseTeam'
toParameterVariable('export')          // 'exportValue'
toParameterVariable('2fa')             // '_2fa'

Returns

string