Skip to main content

destroy

Removes a property from an interaction object using a dot-notation key path.

Import

You can import the entire package and access the function:


_10
import * as sdk from "@onflow/sdk"
_10
_10
sdk.destroy(key)

Or import directly the specific function:


_10
import { destroy } from "@onflow/sdk"
_10
_10
destroy(key)

Usage


_16
import { destroy, put, get, initInteraction } from "@onflow/sdk"
_16
_16
const interaction = initInteraction();
_16
_16
// Set some values
_16
put("user.name", "Alice")(interaction);
_16
put("user.email", "alice@example.com")(interaction);
_16
put("user.temp", "temporary data")(interaction);
_16
_16
console.log(get(interaction, "user.temp")); // "temporary data"
_16
_16
// Remove temporary data
_16
destroy("user.temp")(interaction);
_16
_16
console.log(get(interaction, "user.temp")); // undefined
_16
console.log(get(interaction, "user.name")); // "Alice" (still exists)

Parameters

key

  • Type: string
  • Description: The dot-notation key path to remove

Returns

function


Rate this page