weigh-js
Version:
A lightweight TypeScript library for estimating memory usage of JavaScript objects.
52 lines • 1.99 kB
TypeScript
import { URL } from "url";
import { IMemoryReport, IProfiler, ISizeStrategy } from "./types";
import { eMemoryUnit } from "./enum";
export declare class URLSizeStrategy implements ISizeStrategy {
supports(value: any): boolean;
sizeOf(value: URL, _profiler: IProfiler): number;
}
export declare class TypedArraySizeStrategy implements ISizeStrategy {
private readonly constructors;
supports(value: any): boolean;
sizeOf(value: ArrayBufferView, _profiler: IProfiler): number;
}
export declare class ArrayBufferStrategy implements ISizeStrategy {
supports(value: any): boolean;
sizeOf(value: ArrayBuffer, _profiler: IProfiler): number;
}
export declare class DataViewStrategy implements ISizeStrategy {
supports(value: any): boolean;
sizeOf(value: DataView, _profiler: IProfiler): number;
}
export declare class FunctionSizeStrategy implements ISizeStrategy {
supports(value: any): boolean;
sizeOf(fn: Function, profiler: IProfiler): number;
}
export declare class WeakRefStrategy implements ISizeStrategy {
supports(value: any): boolean;
sizeOf(_value: any, _profiler: IProfiler): number;
}
export declare class RegExpStrategy implements ISizeStrategy {
supports(value: any): boolean;
sizeOf(value: any, profiler: IProfiler): number;
}
export declare class ArrayStrategy implements ISizeStrategy {
supports(value: any): boolean;
sizeOf(value: any, profiler: IProfiler): number;
}
export declare class Profiler implements IProfiler {
private visited;
private strategies;
constructor(options?: {
strategies?: ISizeStrategy[];
});
sizeOf(value: any): number;
computeSize(value: any): number;
isVisited(value: any): boolean;
markVisited(value: any): void;
addStrategy(strategy: ISizeStrategy): void;
computeDetailedSize(value: any): IMemoryReport;
private _computeDetailed;
static formatSize(bytes: number, unit?: eMemoryUnit): string;
}
//# sourceMappingURL=weigh.d.ts.map