mobx-keystone
Version:
A MobX powered state management solution based on data trees with first class support for TypeScript, snapshots, patches and much more
17 lines (14 loc) • 364 B
text/typescript
import { AnyFunction } from "../utils/AnyFunction"
/**
* @internal
*/
export const modelActionSymbol = Symbol("modelAction")
/**
* Returns if the given function is a model action or not.
*
* @param fn Function to check.
* @returns
*/
export function isModelAction(fn: AnyFunction): boolean {
return typeof fn === "function" && modelActionSymbol in fn
}