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

locutus

v3.0.32

Published

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

Readme

Locutus

CI npm version Verified: PHP 8.3 Verified: Python 3.12

All your standard libraries will be assimilated into our ~~JavaScript~~ TypeScript collective. Resistance is futile.

Locutus is ~500 TypeScript implementations of standard library functions from PHP, Go, Python, Ruby, C, and more. Each function is individually importable and tree-shakeable.

Most of these started as rainy Sunday afternoon puzzles. Some are genuinely useful. Some are just fun to write. All of them are a way to learn how different languages solve the same problems.

Scope

Locutus ports function behavior, not foreign runtime baggage. We reimplement standard-library semantics in TypeScript, but keep API boundaries JavaScript-native.

That means we do not recreate alien language data structures or object models in Locutus APIs (for example: Go slices/maps, Python tuples/bytes, Ruby symbols, C structs/pointers, Perl refs).

Historic exception: for PHP compatibility, plain JS objects may be treated as associative arrays when locutus.objectsAsArrays is enabled.

Example: a Go date-formatting port in Locutus should accept a JavaScript Date and return a string, not a custom Go time.Time object.

Install

npm install locutus

Locutus uses pragmatic versioning: patch is the default even for function-level parity fixes; see CONTRIBUTING.md#versioning for exact bump criteria.

Use

import { sprintf } from 'locutus/php/strings/sprintf'

const effectiveness = 'futile'
console.log(sprintf('Resistance is %s', effectiveness))
// Resistance is futile
import { Contains } from 'locutus/golang/strings/Contains'

console.log(Contains('Locutus', 'cut'))
// true

Bundle Size

For bundle-sensitive browser builds, prefer per-function deep imports over category index imports.

Good:

import { sprintf } from 'locutus/php/strings/sprintf'

Avoid in browser bundles:

import { sprintf } from 'locutus/php/strings/index'

Why:

  • deep imports only pull the function you asked for and its real dependencies
  • category index imports can force bundlers to traverse many unrelated exports in the same namespace
  • this matters most in prebundled UMD/browser artifacts where downstream tree-shaking cannot recover later

If you are publishing your own browser bundle on top of Locutus, treat deep imports as the default.

Browser Compatibility (Copy-Paste Snippets)

Code shown on function pages (Module JS / Standalone JS) targets:

  • baseline widely available with downstream

Package runtime targets:

  • Node: engines.node >= 22
  • Published dist output (dist/ CommonJS + dist/esm ESM): ES2022

If your application targets older browsers, treat Locutus snippets like normal application code:

  1. transpile to your target (for example with TypeScript, Babel, SWC, or esbuild)
  2. add required polyfills for missing APIs in your environment
  3. validate with your own Browserslist target and browser test matrix

Locutus does not inject polyfills into copy-paste snippets by default.

Development

Some guidelines and instructions can be found in CONTRIBUTING.md

Quick commands:

  • yarn check - format + lint + test
  • yarn test:parity - cross-language verification
  • yarn test - full test suite
  • yarn lint - Biome check
  • yarn fix:biome - auto-fix

License

MIT, except for src/php/bc/ and src/php/_helpers/_bc.js which are LGPL-2.1 (derived from PHP's bcmath/Libbcmath). See LICENSE for details.