Fast Brake 💨
Super Fast JS Powered Match Detection

Detect JavaScript features, API usage, patterns, and more using a plugin-based architecture for comprehensive code analysis.

bun add -g fast-brake

Very Fast Performance

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.

11
Feature Categories
ES features, APIs, patterns, and more
500k+
Operations/sec
Process thousands of files in seconds
High
Detection Accuracy
Two-phase validation for accurate detection

Live Benchmark Results

*Benchmarked on 2025-12-06 with ES2015 test files on MacBook Pro M4. Preprocessing is only needed for unminified source with comments.
ParserMethodTime (ms)Ops/secSpeed
fast-brakePattern matching0.003360,7021.0x
fast-brake (preprocess)With comment stripping0.008126,1270.35x
meriyahFast ES parser0.01759,1620.16x
cherowES parser0.02049,2140.14x
acornLightweight parser0.06016,6410.046x
@babel/parserFull AST parser0.07413,4240.037x

Built for Failing Fast!

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.

Version-Aware Detection

Tests 150+ ES features across ES5, ES2015-ES2025 versions

Zero Dependencies

Lightweight and fast with no runtime dependencies to slow you down

Production Ready

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.

Plugin-Based Architecture

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.

Plugin Schema

interface Plugin {
name: string;
description: string;
spec: PluginSpec;
}
 
interface PluginSpec {
orderedRules: string[];
matches: Record<string, PluginMatch>;
}
 
interface PluginMatch {
rule: string;
strings?: string[];
patterns?: PluginPattern[];
}

Example Plugin

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"
}]
}
}
}
};

Built-in Plugins

ES Version Plugin

Detects ES5 through ES2025 features with 40+ patterns

Telemetry Plugin

Identifies analytics and tracking code patterns

Browserlist Plugin

Checks compatibility with browser versions

Detect Plugin

Auto-detects minimum required ES version

With Extension Support

Extensions enhance detection results with additional metadata and processing. Add location information, implement fail-fast behavior, or create custom processors for your specific needs.

Extension Schema

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';
}

Example Extension

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
}
};
});
}
};

Built-in Extensions

LOC Extension

Adds precise line, column, and offset information to detected features

Throw Extension

Analyzes throw statements and error handling patterns

Preprocessor Support

Transform and filter code before detection with preprocessors. Strip comments, normalize code, or apply custom transformations to improve detection accuracy and performance.

Built-in Preprocessors

Skip Comments

Efficiently skips comments and string literals during detection

Install Fast Brake

Install fast-brake globally, as a devDependency, or use with npx.

bun add -g fast-brake