@E18e/Typed Array Byte Length

1.0.5Last update Aug 9, 2024
by@e18e

Typed Array Byte Length Codemod

Introduction

This codemod removes the dependency on the typed-array-byte-length module and replaces its usage with the native byteLength property from typed arrays. This reduces unnecessary dependencies, optimizes bundle size, and leverages built-in JavaScript features for better performance.

Before

import typedArrayByteLength from 'typed-array-byte-length';
const length = typedArrayByteLength(new Uint8Array([1, 2, 3]));

After

const length = new Uint8Array([1, 2, 3]).byteLength;

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now