import { isNumber } from "util" ; import { Either , isLeft , left , right } from "fp-ts/lib/Either" ; export default class RedisStorageUtils { see https protected singleStringReply ( err , reply ) { if ( err ) { return left < Error , boolean > ( err ) ; } return right < Error , boolean > ( reply === "OK" ) ; } see https protected integerReply ( err , reply , expectedReply ? ) { if ( err ) { return left < Error , boolean > ( err ) ; } if ( expectedReply !== undefined && expectedReply !== reply ) { return right < Error , boolean > ( false ) ; } return right < Error , boolean > ( isNumber ( reply ) ) ; } protected falsyResponseToError ( response , error ) { if ( isLeft ( response ) ) { return left ( response . value ) ; } else { if ( response . value ) { return right ( true ) ; } return left ( error ) ; } } }