{"name":"locutus","version":"2.0.36","keywords":["php","golang","c","ruby","python","js","locutus"],"author":{"name":"Kevin van Zonneveld","email":"kevin@vanzonneveld.net"},"license":"MIT","_id":"locutus@2.0.36","maintainers":[{"name":"kvz","email":"kevin@vanzonneveld.net"}],"homepage":"https://locutus.io","bugs":{"url":"https://github.com/locutusjs/locutus/issues"},"dist":{"shasum":"768f434fbe78bbc854dd92b0ebddc200ff7e9729","tarball":"http://registry-npm.ywwl.com/locutus/download/locutus-2.0.36.tgz","fileCount":513,"integrity":"sha512-+3hKFMwfpzZW05m0BgCskzOh+eU3Hojq9su8Wtiit+SSpxhcLE+UigX3vC+OUu0bBduLSdSIg9J+8vAUP3y/IQ==","signatures":[{"sig":"MEQCIFXhNgWRWLiCKTb6UAISUlJmLY5xIwBV2KwJeA96Z0GqAiBbbjdOdgBli+920DLc8p3RyewW81XdG2mkWMELtROkjw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/locutus@2.0.36","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":749370,"size":189049,"noattachment":false,"key":"/locutus/-/locutus-2.0.36.tgz"},"browser":{"fs":false,"child_process":false},"engines":{"node":">= 22","yarn":">= 1"},"gitHead":"e4ceb110c02362c1c90fc03f26a48c137b1f1a49","scripts":{"fix":"npm-run-all --serial 'fix:**'","lint":"biome check .","test":"npm-run-all test:languages test:module","build":"npm-run-all 'build:*'","check":"npm-run-all --serial fix:biome lint lint:ts lint:headers lint:no-stray-js test:languages","lint:ts":"tsc --noEmit -p tsconfig.json","fix:biome":"biome check --write .","injectweb":"rimraf website/source/{c,golang,php,python,ruby} && node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON src/_util/cli.ts injectweb","test:util":"vitest run test/util/","build:dist":"rimraf dist && cp -r src dist && rm -rf dist/_util && cp package.json README.md dist/","build:tests":"rimraf test/generated && node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON src/_util/cli.ts writetests","fix:headers":"node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON src/_util/formatHeaders.ts fix","test:module":"node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON test/module/module.ts","test:parity":"node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON test/parity/index.ts","fix:markdown":"remark {README,CONTRIBUTING}.md --output","lint:headers":"node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON src/_util/formatHeaders.ts check","browser:watch":"budo test/browser/app.js --live --serve test/browser/bundle.js","build:indices":"node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON src/_util/cli.ts reindex","website:build":"cd website && yarn generate","website:clean":"cd website && yarn clean","website:start":"cd website && yarn server","browser:bundle":"browserify test/browser/app.js --outfile test/browser/bundle.js","test:languages":"yarn build:tests && vitest run","website:deploy":"cd website && yarn deploy","test:parity:php":"node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON test/parity/index.ts php","website:install":"cd website && yarn","lint:no-stray-js":"bash -c 'found=$(find src test -name \"*.js\" | grep -vE \"^src/(awk|c|clojure|elixir|golang|julia|lua|perl|php|python|r|ruby)/|/index\\.js$|^test/browser/\"); if [ -n \"$found\" ]; then echo \"Stray .js files found (should be .ts):\"; echo \"$found\"; exit 1; fi'","playground:start":"cd test/browser && node server.js","build:tests:noskip":"rimraf test/generated && node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON src/_util/cli.ts writetests --noskip","test:languages:noskip":"yarn build:tests:noskip && vitest run"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:324c95d5-520d-4d13-958a-e189642a43e1"}},"repository":{"url":"git+https://github.com/locutusjs/locutus.git","type":"git"},"_npmVersion":"11.7.0","description":"Locutus other languages' standard libraries to JavaScript for fun and educational purposes","directories":{},"_nodeVersion":"22.21.1","_hasShrinkwrap":false,"packageManager":"yarn@4.12.0","devDependencies":{"zod":"^4.3.5","budo":"11.8.4","knip":"^5.80.0","debug":"^4.4.3","p-map":"^7.0.4","globby":"4.1.0","lodash":"4.17.21","rimraf":"6","vitest":"^4.0.16","esprima":"4.0.1","js-yaml":"4.1.1","cross-env":"10","browserify":"17.0.1","remark-cli":"^12.0.1","remark-toc":"^9.0.0","typescript":"^5.9.3","@types/node":"^25.0.3","npm-run-all":"^4.1.5","indent-string":"2.1.0","@biomejs/biome":"^2.3.11"},"_npmOperationalInternal":{"tmp":"tmp/locutus_2.0.36_1767905526616_0.6489549340909826","host":"s3://npm-registry-packages-npm-production"},"readme":"# Locutus\n\n[![CI](https://github.com/locutusjs/locutus/actions/workflows/ci.yml/badge.svg)](https://github.com/locutusjs/locutus/actions/workflows/ci.yml)\n[![npm version](https://img.shields.io/npm/v/locutus.svg)](https://www.npmjs.com/package/locutus)\n[![Verified: PHP 8.3](https://img.shields.io/badge/verified-PHP%208.3-777BB4.svg)](https://locutus.io/php/)\n[![Verified: Python 3.12](https://img.shields.io/badge/verified-Python%203.12-3776AB.svg)](https://locutus.io/python/)\n\n> All your standard libraries will be assimilated into our ~~JavaScript~~ TypeScript collective. Resistance is futile.\n\nLocutus is ~500 TypeScript implementations of standard library functions from PHP, Go, Python, Ruby, C, and [more](https://locutus.io/). Each function is individually importable and tree-shakeable.\n\nMost 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.\n\n## Scope\n\nLocutus ports function behavior, not foreign runtime baggage. We reimplement standard-library semantics in TypeScript, but keep API boundaries JavaScript-native.\n\nThat 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).\n\nHistoric exception: for PHP compatibility, plain JS objects may be treated as associative arrays when `locutus.objectsAsArrays` is enabled.\n\nExample: a Go date-formatting port in Locutus should accept a JavaScript `Date` and return a `string`, not a custom Go `time.Time` object.\n\n## Install\n\n```bash\nnpm install locutus\n```\n\nLocutus uses pragmatic versioning: `patch` is the default even for function-level parity fixes; see\n`CONTRIBUTING.md#versioning` for exact bump criteria.\n\n## Use\n\n```typescript\nimport { sprintf } from 'locutus/php/strings/sprintf'\n\nconst effectiveness = 'futile'\nconsole.log(sprintf('Resistance is %s', effectiveness))\n// Resistance is futile\n```\n\n```typescript\nimport { Contains } from 'locutus/golang/strings/Contains'\n\nconsole.log(Contains('Locutus', 'cut'))\n// true\n```\n\n## Bundle Size\n\nFor bundle-sensitive browser builds, prefer per-function deep imports over category index imports.\n\nGood:\n\n```typescript\nimport { sprintf } from 'locutus/php/strings/sprintf'\n```\n\nAvoid in browser bundles:\n\n```typescript\nimport { sprintf } from 'locutus/php/strings/index'\n```\n\nWhy:\n\n- deep imports only pull the function you asked for and its real dependencies\n- category index imports can force bundlers to traverse many unrelated exports in the same namespace\n- this matters most in prebundled UMD/browser artifacts where downstream tree-shaking cannot recover later\n\nIf you are publishing your own browser bundle on top of Locutus, treat deep imports as the default.\n\n## Browser Compatibility (Copy-Paste Snippets)\n\nCode shown on function pages (`Module JS` / `Standalone JS`) targets:\n\n- `baseline widely available with downstream`\n\nPackage runtime targets:\n\n- Node: `engines.node >= 22`\n- Published dist output (`dist/` CommonJS + `dist/esm` ESM): `ES2022`\n\nIf your application targets older browsers, treat Locutus snippets like normal application code:\n\n1. transpile to your target (for example with TypeScript, Babel, SWC, or esbuild)\n2. add required polyfills for missing APIs in your environment\n3. validate with your own Browserslist target and browser test matrix\n\nLocutus does not inject polyfills into copy-paste snippets by default.\n\n## Development\n\nSome guidelines and instructions can be found in [CONTRIBUTING.md](CONTRIBUTING.md)\n\nQuick commands:\n\n- `yarn check` - format + lint + test\n- `yarn test:parity` - cross-language verification\n- `yarn test` - full test suite\n- `yarn lint` - Biome check\n- `yarn fix:biome` - auto-fix\n\n## License\n\nMIT, except for `src/php/bc/` and `src/php/_helpers/_bc.js` which are LGPL-2.1 (derived from PHP's bcmath/Libbcmath). See [LICENSE](LICENSE) for details.\n","publish_time":1767905526834,"_cnpm_publish_time":1767905526834,"dist-tags":{"latest":"3.0.36"}}