MCPcopy
hub / github.com/angular/angularfire / createDataOperationMethod

Function createDataOperationMethod

src/compat/database/list/data-operation.ts:4–12  ·  view source on GitHub ↗
(ref: DatabaseReference, operation: string)

Source from the content-addressed store, hash-verified

2import { checkOperationCases } from '../utils';
3
4export function createDataOperationMethod(ref: DatabaseReference, operation: string) {
5 return function dataOperation<T>(item: FirebaseOperation, value: T) {
6 return checkOperationCases(item, {
7 stringCase: () => ref.child(item as string)[operation](value),
8 firebaseCase: () => (item as DatabaseReference)[operation](value),
9 snapshotCase: () => (item as DatabaseSnapshot<T>).ref[operation](value)
10 });
11 };
12}

Callers 1

createListReferenceFunction · 0.90

Calls 2

checkOperationCasesFunction · 0.90
childMethod · 0.80

Tested by

no test coverage detected