isBytesLike

Learn about the isBytesLike utils method.

Learn about the isBytesLike utils method.

Introduction

The isBytesLike method is used to check if a value is a “bytes-like” object.

Usage

This method should be used when you want to check if a value is a “bytes-like” object. This means that the value must be a string, an array, or a Uint8Array.

Here’s a simple code example to demonstrate how to use this method:

Javascript
1const { Utils } = require("alchemy-sdk");
2
3let stringValue = "0x010203";
4
5let isBytesLike = Utils.isBytesLike(stringValue);
6console.log(isBytesLike); // true