{"library":"constantinople","type":"library","category":null,"description":"Constantinople is a JavaScript utility package, currently at stable version 4.0.1, designed to determine if a given JavaScript expression evaluates to a constant. It parses the expression into an Abstract Syntax Tree (AST) using Babylon (now part of Babel's parser) to analyze its predictability. The library prioritizes safety, conservatively returning `false` if there's any uncertainty, ensuring reliability for build tools and static analysis where incorrect constant detection could cause issues. It also provides a `toConstant` function to safely evaluate expressions identified as constant, throwing an error if the expression is not constant. The package ships with TypeScript type definitions, enhancing developer experience for TypeScript users.","language":"javascript","status":"active","version":"4.0.1","tags":["javascript","constant","ast","tooling","typescript"],"last_verified":"Wed May 27","install":[{"cmd":"npm install constantinople","imports":["import isConstant from 'constantinople';","const isConstant = require('constantinople');","import isConstant from 'constantinople';\nconst result = isConstant.toConstant('some_expression');"]},{"cmd":"yarn add constantinople","imports":[]},{"cmd":"pnpm add constantinople","imports":[]}],"homepage":null,"github":"https://github.com/ForbesLindesay/constantinople","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/constantinople","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/constantinople/compatibility"}}