@E18e/Data View Byte Offset

/icons/calendar.svg

Last update

Aug 9, 2024

Data View Byte Offset Codemod

Introduction

This codemod replaces the usage of the data-view-byte-offset npm module with a direct utilization of the built-in DataView feature in JavaScript. It eliminates the unnecessary dependency, reduces bundle size, and leverages native functionality for improved performance.

Before

import { byteOffset } from 'data-view-byte-offset';
const view = new DataView(buffer);
const offset = byteOffset(view, index);

After

const view = new DataView(buffer);
const offset = view.byteOffset(index);

Build custom codemods

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

background illustrationGet Started Now