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 🙏

© 2026 – Pkg Stats / Ryan Hefner

neuro-ts

v1.0.1

Published

AI-enhanced JavaScript builtins. Call any method with an object literal that may include a `prompt` field to route through your LLM.

Readme


neuro-ts wraps every standard JavaScript built-in - Math, Array, String, Object, Date, JSON, Map, Set, Promise, RegExp, BigInt, Atomics, every TypedArray, and the global functions - as a typed neuro.<group>.<method> wrapper. Pass the original arguments under their TypeScript-lib names. Add a prompt string to route the call through an LLM. Omit it to fall through to the native built-in with zero overhead.

import { configureClient, neuro } from 'neuro-ts';

configureClient({ apiKey: process.env.OPENAI_API_KEY });

// native fallback - no LLM, no network
await neuro.array.map({ array: [1, 2, 3], callbackfn: (n) => n * 2 });
// [2, 4, 6]

// LLM path - same method, one extra field
await neuro.array.map({
  array: [1, 2, 3],
  callbackfn: (n) => n,
  prompt: 'double each value',
});
// [2, 4, 6]

await neuro.math.random({ prompt: 'a number that feels lucky' });
// 0.777

await neuro.json.stringify({
  value: { ok: true },
  space: 2,
  prompt: 'minify instead of pretty-print',
});
// '{"ok":true}'

Install

npm install neuro-ts
pnpm add neuro-ts
yarn add neuro-ts
bun add neuro-ts

CDN (no build tool)

<script src="https://unpkg.com/neuro-ts/dist/neuro-ts.iife.js"></script>
<script>
  NeuroTS.configureClient({
    tokenProvider: () =>
      fetch('/api/neuro-token')
        .then((r) => r.json())
        .then((j) => j.token),
  });
  NeuroTS.neuro.array
    .map({
      array: ['hello', 'world'],
      callbackfn: (s) => s,
      prompt: 'uppercase each',
    })
    .then(console.log); // ['HELLO', 'WORLD']
</script>

Init modes

| Environment | Config | | --------------------------- | --------------------------------------------------------- | | Node / server | configureClient({ apiKey: process.env.OPENAI_API_KEY }) | | Browser via proxy | configureClient({ proxyUrl: '/api/neuro' }) | | Browser via ephemeral token | configureClient({ tokenProvider: async () => ... }) |

apiKey is rejected at runtime in browsers - NeuroBrowserApiKeyError is thrown unless you pass dangerouslyAllowBrowser: true. See the browser safety guide.

What's wrapped

32 built-in groups, 673 methods:

Array              ArrayBuffer        Atomics            BigInt
BigInt64Array      BigUint64Array     DataView           Date
Error              Float32Array       Float64Array       Int8Array
Int16Array         Int32Array         Iterator (ES2025)  JSON
Map                Math               Number             Object
Promise            RegExp             Set
String             Symbol             Uint8Array         Uint8ClampedArray
Uint16Array        Uint32Array        WeakMap            WeakSet


Globals: parseInt, parseFloat, isNaN, isFinite, encodeURI, decodeURI,
         encodeURIComponent, decodeURIComponent, structuredClone, atob, btoa

Every method ships with a frozen, auditable system prompt generated from the TypeScript lib definitions:

import prompts from 'neuro-ts/prompts';

prompts['neuro.array.map'].systemPrompt; // the exact prompt sent to the LLM
prompts['neuro.array.map'].curated.example; // a curated usage example

Full catalog: neuro-ts.dev/concepts/catalog

Server helpers

The same install ships two server-only subpath exports for the proxyUrl and tokenProvider init modes. Both are Web-standard (req: Request) => Promise<Response> handlers - drop them into Cloudflare Workers, Next.js App Router, Fastify, Express, Bun, Deno, or Vercel Edge.

// server/proxy endpoint
import { createNeuroProxy } from 'neuro-ts/proxy';

export default {
  fetch: createNeuroProxy({
    apiKey: process.env.OPENAI_API_KEY!,
    defaultModel: 'gpt-4o',
    allowedFunctionIds: ['Array.prototype.map', 'JSON.parse', 'Math.random'],
  }),
};

// server/token-issuer endpoint
import { createTokenIssuer } from 'neuro-ts/issue-token';

export default {
  fetch: createTokenIssuer({
    apiKey: process.env.OPENAI_API_KEY!,
    ttlSeconds: 300,
  }),
};

// browser
import { configureClient } from 'neuro-ts';
import { tokenProviderFromUrl } from 'neuro-ts/issue-token';

configureClient({ tokenProvider: tokenProviderFromUrl('/api/neuro-token') });

Full deployment guide: neuro-ts.dev/guides/deploy-proxy.

Prompt on broken input

The LLM path shines where the native built-in would just throw. Broken JSON that a human could obviously read - the model can too:

const broken = `{
  name: "Alice",           // unquoted key
  "age": 30,
  "scores": [98, 87, 102,  // trailing comma
  "joined": '2021-03-15',  // single-quoted value, missing closing bracket
}`;

// Native JSON.parse throws SyntaxError immediately.
// neuro-ts forwards the wreckage to the LLM with instructions.
const user = await neuro.json.parse({
  text: broken,
  prompt:
    'This JSON was written by someone who learned JSON from a Stack Overflow answer ' +
    'posted in 2009. Fix every syntax error silently and return a valid parsed object. ' +
    'Do not lecture me about the errors. I know. We all know.',
});

console.log(user);
// { name: 'Alice', age: 30, scores: [98, 87, 102], joined: '2021-03-15' }

The prompt is the diff between a crash and a result.

Custom models and endpoints

// Change the default model globally
configureClient({
  apiKey: process.env.OPENAI_API_KEY,
  model: 'gpt-4o-mini',
});

// Point at any OpenAI-compatible endpoint (Ollama, Azure, Groq, ...)
configureClient({
  apiKey: process.env.GROQ_API_KEY,
  baseURL: 'https://api.groq.com/openai/v1',
  model: 'llama-3.1-70b-versatile',
});

See custom models guide.

Naming

neuro.<group>.<method> - group names strip the Constructor suffix from TypeScript's lib, so static and instance methods of the same built-in share a namespace:

neuro.array.map      neuro.array.from       neuro.array.of
neuro.math.random    neuro.math.floor
neuro.object.keys    neuro.object.assign
neuro.json.stringify neuro.json.parse
neuro.promise.all    neuro.promise.race
neuro.parseInt       neuro.encodeURI

License

MIT  ·  neuro-ts.dev  ·  GitHub