npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@raven-js/cortex

v0.4.48

Published

Zero-dependency machine learning, AI, and data processing library for modern JavaScript

Readme

Cortex

Website Zero Dependencies ESM Only Node.js 22.5+

Machine learning, data structures, and temporal computation without dependencies.

Purpose

Platform-native algorithms using Math APIs and Node.js built-ins. Build neural networks, matrix operations, schema validation, and holiday calculations using pure JavaScript primitives.

Structured learning that adapts rather than couples to AI service evolution. Matrix operations optimized for V8 engine performance. Temporal computation with governmental precision across 30+ countries.

Install

npm install @raven-js/cortex

Usage

// Neural networks and machine learning
import { NeuralNetwork, LinearRegression } from "@raven-js/cortex";

const nn = new NeuralNetwork([2, 4, 1]); // 2 inputs, 4 hidden, 1 output
nn.trainBatch(
  [
    [0, 0],
    [0, 1],
    [1, 0],
    [1, 1],
  ],
  [[0], [1], [1], [0]]
);
console.log(nn.predict([1, 0])); // XOR classification

const regression = new LinearRegression();
regression.trainBatch([
  { x: 1, y: 2 },
  { x: 2, y: 4 },
  { x: 3, y: 6 },
]);
console.log(regression.predict({ x: 4 })); // 8
// Matrix operations and data structures
import { Matrix, Schema } from "@raven-js/cortex";

const matrix = Matrix.random(3, 3);
const result = matrix.multiply(Matrix.identity(3));
console.log(result.toString());

class User extends Schema {
  name = Schema.field("", { description: "User name" });
  age = Schema.field(0, { description: "User age" });
}
const user = new User();
user.validate({ name: "Alice", age: 25 });
// Temporal computation with governmental precision
import {
  calculateEasterSunday,
  calculateHolidaysOfYear,
} from "@raven-js/cortex";

const easter2024 = calculateEasterSunday(2024);
console.log(easter2024); // 2024-03-31

const usHolidays = calculateHolidaysOfYear({
  year: 2024,
  country: "US",
  region: "CA",
});
console.log(usHolidays.length); // Federal + California state holidays
// AI text detection with hierarchical cascade
import { isAIText } from "@raven-js/cortex";
import { GERMAN_LANGUAGE_PACK } from "@raven-js/cortex/language/languagepacks/german.js";

const result = isAIText(
  "Das System bietet umfassende Funktionalität für moderne Geschäftsanwendungen.",
  { languagePack: GERMAN_LANGUAGE_PACK }
);

console.log({
  aiLikelihood: result.aiLikelihood, // 0.0-1.0 probability score
  certainty: result.certainty, // Detection confidence
  dominantPattern: result.dominantPattern, // Primary detection signal
  executionTime: result.executionTime, // Performance metrics
});

Module Architecture

Cortex organizes intelligence into four specialized modules:

  • Learning - Neural networks, linear regression, and base model classes for machine learning tasks
  • Language - AI text detection with hierarchical cascade architecture and multi-language support
  • Structures - Matrix operations and schema validation for data manipulation and type safety
  • Temporal - Holiday calculations and date utilities covering 30+ countries with governmental precision
  • Relay - Provider‑agnostic LLM chat abstraction (OpenAI, Anthropic, xAI) with schema‑validated structured outputs

Each module can be imported individually for tree-shaking optimization:

import { NeuralNetwork } from "@raven-js/cortex/learning";
import { isAIText } from "@raven-js/cortex/language";
import { Matrix } from "@raven-js/cortex/structures";
import { calculateEasterSunday } from "@raven-js/cortex/temporal";
import { Chat } from "@raven-js/cortex/relay";

Requirements

  • Node.js 22.5+
  • ESM module support

The Raven's Cortex

Ravens process information through distributed neural networks, sharing learning across the murder. Cortex mirrors this collective intelligence—adaptive algorithms that strengthen through usage, not coupling to external frameworks.

🦅 Support RavenJS Development

If you find RavenJS helpful, consider supporting its development:

GitHub Sponsors

Your sponsorship helps keep RavenJS zero-dependency, modern, and developer-friendly.


Built with ❤️ by Anonyfox