import type { ISubscriber } from "@thi.ng/rstream" ; import { splice } from "@thi.ng/strings/splice" ; import { map } from "@thi.ng/transducers/map" ; export const asSet = ( x ) => new Set ( map ( ( x ) => x . trim ( ) , x . split ( "," ) ) ) ; export const xformAsSet = map ( asSet ) ; export const handleTab = ( stream ) => ( e ) => { if ( e . key === "Tab" ) { e . preventDefault ( ) ; stream . next ( splice ( ( < any > e . target ) . value , "    " , ( < HTMLTextAreaElement > e . target ) . selectionStart ) ) ; } } ; export const varName = ( name ) => name . replace ( /\-+/g , "_" ) ;