isArgument
Checks if an object is an argument resolver.
Import
You can import the entire package and access the function:
_10import * as sdk from "@onflow/sdk"_10_10sdk.isArgument(argument)
Or import directly the specific function:
_10import { isArgument } from "@onflow/sdk"_10_10isArgument(argument)
Usage
_15import { isArgument, arg } from "@onflow/sdk"_15_15const argumentResolver = { kind: "ARGUMENT", value: 42 };_15const regularObject = { value: 42 };_15_15console.log(isArgument(argumentResolver)); // true_15console.log(isArgument(regularObject)); // false_15_15// Check arguments in a script_15const scriptArgs = [arg(10, t.Int), arg("hello", t.String)];_15scriptArgs.forEach(arg => {_15 if (isArgument(arg)) {_15 console.log("Valid argument:", arg.value);_15 }_15});
Parameters
argument
- Type:
Record<string, any>
- Description: The object to check
Returns
boolean