export function expectLength < T extends ReadonlyArray < unknown > > ( array , ... lengths ) { for ( const length of lengths ) { if ( array . length === length ) { return ; } } console . error ( array ) ; throw new Error ( `Expected ${ lengths . join ( " or " ) } items, but got ${ array . length }` ) ; } export function concat < T > ( first , ... rest ) ; export function concat < T > ( first , ... rest ) ; export function concat < T > ( first , ... rest ) { let result = first ; for ( const other of rest ) { if ( other . length !== 0 ) { result = result . length !== 0 ? result . concat ( other ) : other ; } } return result ; } export function lookupForMap < V > ( map ) { return ( key ) => Object . hasOwnProperty . call ( map , key ) ? map [ key ] : undefined ; } function toLowerCase ( text ) { return text . toLowerCase ( ) ; } export function camelCase ( text ) { return text . replace ( /^[^a-z]/ , toLowerCase ) ; }