How to use the prelude-ts.Option.none function in prelude-ts

To help you get started, we’ve selected a few prelude-ts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github klemola / foobar2000-web-ui / ui / App.tsx View on Github external
Volume as VolumeType,
    Action
} from '../server/Models'
import Playback from './Playback'
import Volume from './Volume'

// TODO: refactor into an union type
interface AppState {
    connected: boolean
    currentTrack: Option
    volume: VolumeType
}

const initialState: AppState = {
    connected: false,
    currentTrack: Option.none(),
    volume: {
        type: 'audible',
        volume: 0
    }
}

export default class App extends Component<{}, AppState> {
    socket = io('/', {
        autoConnect: false
    })
    state = initialState

    componentDidMount() {
        this.socket.on('message', (message: Message) => {
            switch (message.type) {
                case 'playback':
github klemola / foobar2000-web-ui / server / Message.ts View on Github external
l => {
            const messageResult = parseMessage(l)
            return messageResult.success
                ? Option.of(messageResult.value)
                : Option.none()
        }
    )

prelude-ts

A typescript functional programming library

ISC
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis