import { createSignal } from 'solid-js' ; import { is } from './utils' ; export interface Atom < T > { ( ) : T ; ( value ) : T ; } export default function atom < T > ( value , equals = is ) { const [ state , setState ] = createSignal ( value , { equals , } ) ; return ( ... args ) : T => { if ( args . length === 1 ) { setState ( ( ) => args [ 0 ] ) ; } return state ( ) ; } ; }