@@ -103,13 +103,13 @@ export function checkHooks(message: string): boolean {
103103
104104// Input validation utils that will be replaced eventually
105105
106- export function validateSplits ( maybeSplits : unknown , listName = 'split names' ) : false | string [ ] {
107- if ( Array . isArray ( maybeSplits ) && maybeSplits . length > 0 ) {
106+ export function validateFeatureFlags ( maybeFeatureFlags : unknown , listName = 'split names' ) : false | string [ ] {
107+ if ( Array . isArray ( maybeFeatureFlags ) && maybeFeatureFlags . length > 0 ) {
108108 const validatedArray : string [ ] = [ ] ;
109109 // Remove invalid values
110- maybeSplits . forEach ( ( maybeSplit ) => {
111- const splitName = validateSplit ( maybeSplit ) ;
112- if ( splitName ) validatedArray . push ( splitName ) ;
110+ maybeFeatureFlags . forEach ( ( maybeFeatureFlag ) => {
111+ const featureFlagName = validateFeatureFlag ( maybeFeatureFlag ) ;
112+ if ( featureFlagName ) validatedArray . push ( featureFlagName ) ;
113113 } ) ;
114114
115115 // Strip off duplicated values if we have valid split names then return
@@ -129,19 +129,19 @@ export function initAttributes(client: SplitIO.IBrowserClient, attributes?: Spli
129129
130130const TRIMMABLE_SPACES_REGEX = / ^ [ \s \uFEFF \xA0 ] + | [ \s \uFEFF \xA0 ] + $ / ;
131131
132- function validateSplit ( maybeSplit : unknown , item = 'split name' ) : false | string {
133- if ( maybeSplit == undefined ) {
132+ function validateFeatureFlag ( maybeFeatureFlag : unknown , item = 'split name' ) : false | string {
133+ if ( maybeFeatureFlag == undefined ) {
134134 console . log ( `[ERROR] you passed a null or undefined ${ item } , ${ item } must be a non-empty string.` ) ;
135- } else if ( ! isString ( maybeSplit ) ) {
135+ } else if ( ! isString ( maybeFeatureFlag ) ) {
136136 console . log ( `[ERROR] you passed an invalid ${ item } , ${ item } must be a non-empty string.` ) ;
137137 } else {
138- if ( TRIMMABLE_SPACES_REGEX . test ( maybeSplit ) ) {
139- console . log ( `[WARN] ${ item } "${ maybeSplit } " has extra whitespace, trimming.` ) ;
140- maybeSplit = maybeSplit . trim ( ) ;
138+ if ( TRIMMABLE_SPACES_REGEX . test ( maybeFeatureFlag ) ) {
139+ console . log ( `[WARN] ${ item } "${ maybeFeatureFlag } " has extra whitespace, trimming.` ) ;
140+ maybeFeatureFlag = maybeFeatureFlag . trim ( ) ;
141141 }
142142
143- if ( ( maybeSplit as string ) . length > 0 ) {
144- return maybeSplit as string ;
143+ if ( ( maybeFeatureFlag as string ) . length > 0 ) {
144+ return maybeFeatureFlag as string ;
145145 } else {
146146 console . log ( `[ERROR] you passed an empty ${ item } , ${ item } must be a non-empty string.` ) ;
147147 }
0 commit comments