@E18e/Typed Array Byte Offset

/icons/calendar.svg

Last update

Aug 9, 2024

Typed Array Byte Offset Codemod

Introduction

This codemod replaces the typed-array-byte-offset npm module with built-in ES features. It eliminates the dependency by transforming calls to the module into direct usage of the byteOffset property from typed array instances. The ultimate goal is to reduce unnecessary dependencies and improve performance within the codebase.

Before

import byteOffset from 'typed-array-byte-offset';
const offset = byteOffset(new Uint8Array(buffer));

After

const offset = new Uint8Array(buffer).byteOffset;

Build custom codemods

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

background illustrationGet Started Now