import { DatabaseReference , DatabaseSnapshot , FirebaseOperation } from '../interfaces' ; import { checkOperationCases } from '../utils' ; export function createDataOperationMethod < T > ( ref , operation ) { return function dataOperation < T > ( item , value ) { return checkOperationCases ( item , { stringCase : ( ) => ref . child ( item as string ) [ operation ] ( value ) , firebaseCase : ( ) => ( item as DatabaseReference ) [ operation ] ( value ) , snapshotCase : ( ) => ( item as DatabaseSnapshot < T > ) . ref [ operation ] ( value ) } ) ; } ; }