Skip to content

🌡️ Get the optimization status of a function from the point of view of V8 engine.

License

Notifications You must be signed in to change notification settings

GMartigny/opti-status

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opti-status

NPM version

Get the optimization status of a function from the point of view of V8 engine.

Installation

$ npm install opti-status

Usage

const optiStatus = require("opti-status");

const myFunc = () => {
    // ...
};

console.log(optiStatus(myFunc).message);

API

optiStatus(func, [...args])

The main function accept a function or a string as first argument and as many additional arguments as you want. The passed function will be called with the additional arguments as parameters. Return an object containing the original status code, the passed function and a human readable message explaining the status.

example:

{
    status: 49,
    function: [Function],
    message: "This is a function, optimized and turbo-fanned.",
}

optiStatus.statuses

The set of possible statuses according to V8. You need to use a bitwise comparison of the status code to know if each flag is active or not.

example:

if (optiStatus(func).status & optiStatus.statuses.isOptimized) {
    console.log("Great work!");
}

License

MIT

About

🌡️ Get the optimization status of a function from the point of view of V8 engine.

Topics

Resources

License

Security policy

Stars

Watchers

Forks