Fast Brake is a detection library that's 6-19x faster than full parsers through efficient pattern matching. Ideal for build tools, CI/CD pipelines, and large codebases where speed matters.
| Parser | Method | Time (ms) | Ops/sec | Speed |
|---|---|---|---|---|
| fast-brake | Pattern matching | 0.003 | 360,702 | 1.0x |
| fast-brake (preprocess) | With comment stripping | 0.008 | 126,127 | 0.35x |
| meriyah | Fast ES parser | 0.017 | 59,162 | 0.16x |
| cherow | ES parser | 0.020 | 49,214 | 0.14x |
| acorn | Lightweight parser | 0.060 | 16,641 | 0.046x |
| @babel/parser | Full AST parser | 0.074 | 13,424 | 0.037x |
Fast Brake uses intelligent pattern matching to detect ES features across 11 different JavaScript versions (ES5-ES2025). Unlike simple parsers that only validate syntax, Fast Brake identifies which specific ES version your code requires, making it perfect for compatibility checking.
Tests 150+ ES features across ES5, ES2015-ES2025 versions
Lightweight and fast with no runtime dependencies to slow you down
Tested across diverse codebases in CI/CD pipelines and build tools
Perfect for build tools, bundlers, and CI/CD pipelines where speed matters. Use traditional AST parsers for code transformation and detailed analysis.
Fast Brake uses a flexible plugin system for feature detection. Mix and match plugins or create your own to detect custom patterns, telemetry, or specific JavaScript features.
interface Plugin { name: string; description: string; spec: PluginSpec;}Â interface PluginSpec { orderedRules: string[]; matches: Record<string, PluginMatch>;}Â interface PluginMatch { rule: string; strings?: string[]; patterns?: PluginPattern[];}const telemetryPlugin = { name: "telemetry-detector", description: "Detects telemetry usage", spec: { orderedRules: ["analytics"], matches: { "google_analytics": { rule: "analytics", strings: ["gtag", "ga("], patterns: [{ pattern: "gtag\\('config'", identifier: "gtag_config" }] } } }};Detects ES5 through ES2025 features with 40+ patterns
Identifies analytics and tracking code patterns
Checks compatibility with browser versions
Auto-detects minimum required ES version
Extensions enhance detection results with additional metadata and processing. Add location information, implement fail-fast behavior, or create custom processors for your specific needs.
interface Extension { name: string; initialize?: (options: ExtensionOptions) => void; process: ProcessFunction; options?: ExtensionOptions;} interface ExtendedFeature extends DetectedFeature { name: string; version: string; match?: RegExpMatch; loc?: LocationInfo; context?: string; severity?: 'info' | 'warning' | 'error';}const locExtension: Extension = { name: "loc", initialize: (options) => { // Pre-compile any patterns or setup this.includeContext = options.includeContext; this.contextLines = options.contextLines || 2; }, process: (features, code, options) => { return features.map(feature => { const lines = code.split('\n'); const position = getPosition(feature.match); return { ...feature, loc: { line: position.line, column: position.column, offset: feature.match.index } }; }); }};Adds precise line, column, and offset information to detected features
Analyzes throw statements and error handling patterns
Transform and filter code before detection with preprocessors. Strip comments, normalize code, or apply custom transformations to improve detection accuracy and performance.
Efficiently skips comments and string literals during detection