@E18e/Data View Byte Length

1.0.5Last update Aug 9, 2024
by@e18e

data-view-byte-length Codemod

Introduction

This codemod replaces instances of the data-view-byte-length package with the built-in DataView.byteLength property. The goal is to eliminate unnecessary dependencies, thereby reducing the bundle size and improving the performance of the codebase.

Before

import byteLength from 'data-view-byte-length';
const buffer = new ArrayBuffer(8);
const view = new DataView(buffer);
const length = byteLength(view);

After

const buffer = new ArrayBuffer(8);
const view = new DataView(buffer);
const length = view.byteLength;

Build custom codemods

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

background illustrationGet Started Now