Skip to main content

isArgument

Checks if an object is an argument resolver.

Import

You can import the entire package and access the function:


_10
import * as sdk from "@onflow/sdk"
_10
_10
sdk.isArgument(argument)

Or import directly the specific function:


_10
import { isArgument } from "@onflow/sdk"
_10
_10
isArgument(argument)

Usage


_15
import { isArgument, arg } from "@onflow/sdk"
_15
_15
const argumentResolver = { kind: "ARGUMENT", value: 42 };
_15
const regularObject = { value: 42 };
_15
_15
console.log(isArgument(argumentResolver)); // true
_15
console.log(isArgument(regularObject)); // false
_15
_15
// Check arguments in a script
_15
const scriptArgs = [arg(10, t.Int), arg("hello", t.String)];
_15
scriptArgs.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


Rate this page