{"name":"locutus","version":"3.0.17","keywords":["php","golang","c","ruby","python","js","locutus"],"author":{"name":"Kevin van Zonneveld","email":"kevin@vanzonneveld.net"},"license":"MIT","_id":"locutus@3.0.17","maintainers":[{"name":"kvz","email":"kevin@vanzonneveld.net"}],"homepage":"https://locutus.io","bugs":{"url":"https://github.com/locutusjs/locutus/issues"},"dist":{"shasum":"228125d28c2c1d3872855fdd58bf34124246f67f","tarball":"http://registry-npm.ywwl.com/locutus/download/locutus-3.0.17.tgz","fileCount":2266,"integrity":"sha512-fr9Y7/bI8TShz6OLWpUh7UnSMIChk/rnL9n/U9khW5L/gnzBy5iU58Xq666MTRzavwHOlLN1DAodVQIqn1+uJA==","signatures":[{"sig":"MEQCIC/QvlQrlUzowa0GLKDuPbV/EjBgdsIdy4uiOsuZmsD9AiAYw6+pDtkAzfoh90sm4wW2qPFZ6AX37MOAjWIMf8wjVQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/locutus@3.0.17","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":2583210,"size":387259,"noattachment":false,"key":"/locutus/-/locutus-3.0.17.tgz"},"main":"./index.js","type":"commonjs","types":"./index.d.ts","module":"./esm/index.js","browser":{"fs":false,"child_process":false},"engines":{"node":">= 22","yarn":">= 1"},"exports":{".":{"types":"./index.d.ts","import":"./esm/index.js","default":"./index.js","require":"./index.js"},"./*":{"types":"./*.d.ts","import":"./esm/*.js","default":"./*.js","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"a502444e2eba311e202aa84fe0a439da57ceb9f6","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:ts:strict-next lint:ts:debt:policy lint:api:snapshot lint:type:contracts lint:headers lint:no-stray-js test:languages","lint:ts":"tsc --noEmit -p tsconfig.json","fix:biome":"biome check --write .","injectweb":"node scripts/rmrf.ts website/source/c website/source/golang website/source/php website/source/python website/source/ruby && node src/_util/cli.ts injectweb","test:util":"vitest run test/util/","build:dist":"node scripts/rmrf.ts dist && cp -r src dist && cp package.json README.md dist && tsc -p tsconfig.build.json --outDir dist && tsc -p tsconfig.build.esm.json --outDir dist/esm && find dist -name '*.ts' ! -name '*.d.ts' -delete && node scripts/fix-cjs-exports.ts dist && node scripts/rmrf.ts dist/_util dist/esm/_util","website:ci":"npm-run-all --serial website:install injectweb website:build website:verify","build:tests":"node scripts/rmrf.ts test/generated && node src/_util/cli.ts writetests","fix:headers":"node src/_util/formatHeaders.ts fix","test:module":"npm-run-all --serial build:dist test:module:smoke","test:parity":"node test/parity/index.ts","browser:test":"vitest run --config vitest.browser.config.ts","fix:markdown":"remark {README,CONTRIBUTING}.md --output","lint:headers":"node src/_util/formatHeaders.ts check","browser:watch":"vitest --config vitest.browser.config.ts --watch","build:indices":"node src/_util/cli.ts reindex","select:parity":"node scripts/select-parity-targets.ts","website:build":"cd website && yarn generate","website:clean":"cd website && yarn clean","website:start":"cd website && yarn server","test:languages":"yarn build:tests && vitest run","website:deploy":"cd website && yarn deploy","website:verify":"node scripts/check-website-build.ts","browser:install":"playwright install chromium","test:parity:php":"node test/parity/index.ts php","website:install":"cd website && yarn","fix:api:snapshot":"npm-run-all --serial fix:api:snapshot:php fix:api:snapshot:nonphp","lint:no-stray-js":"node scripts/check-allowed-js-files.ts","playground:start":"yarn browser:watch","lint:api:snapshot":"npm-run-all --serial lint:api:snapshot:php lint:api:snapshot:nonphp","test:module:smoke":"node test/module/module.ts","build:tests:noskip":"node scripts/rmrf.ts test/generated && node src/_util/cli.ts writetests --noskip","fix:type:contracts":"node scripts/check-type-contracts-snapshot.ts --update","lint:ts:debt:policy":"node scripts/check-ts-debt-policy.ts","lint:ts:strict-next":"tsc --noEmit -p tsconfig.strict-next.json","lint:type:contracts":"node scripts/check-type-contracts-snapshot.ts","fix:api:snapshot:php":"node scripts/check-api-signature-snapshot.ts --scope=php --update","test:runtime-surface":"node scripts/check-runtime-surface.ts","compare:dt:signatures":"node scripts/compare-definitelytyped-signatures.ts","lint:api:snapshot:php":"node scripts/check-api-signature-snapshot.ts --scope=php","test:languages:noskip":"yarn build:tests:noskip && vitest run","fix:api:snapshot:nonphp":"node scripts/check-api-signature-snapshot.ts --scope=non-php --update","lint:api:snapshot:nonphp":"node scripts/check-api-signature-snapshot.ts --scope=non-php"},"_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.11.1","description":"Locutus other languages' standard libraries to JavaScript for fun and educational purposes","directories":{},"resolutions":{"glob@npm:^10.0.0":"10.5.0","glob@npm:^10.2.2":"10.5.0","braces@npm:~3.0.2":"3.0.3","glob@npm:^10.3.10":"10.5.0","semver@npm:^5.5.0":"5.7.2","rollup@npm:^4.43.0":"4.59.0","node-gyp@npm:latest":"12.2.0","minimatch@npm:^3.0.4":"3.1.4","minimatch@npm:^9.0.0":"9.0.7","minimatch@npm:^9.0.1":"9.0.7","ansi-regex@npm:^5.0.0":"5.0.1","cross-spawn@npm:^6.0.5":"6.0.6","cross-spawn@npm:^7.0.0":"7.0.5","brace-expansion@npm:^1.1.7":"1.1.12","brace-expansion@npm:^2.0.1":"2.0.2","hosted-git-info@npm:^2.1.4":"2.8.9","semver@npm:2 || 3 || 4 || 5":"5.7.2"},"_nodeVersion":"22.22.0","_hasShrinkwrap":false,"packageManager":"yarn@4.12.0","devDependencies":{"zod":"^4.3.6","knip":"^5.86.0","debug":"^4.4.3","p-map":"^7.0.4","vitest":"^4.0.18","js-yaml":"4.1.1","cross-env":"10","playwright":"^1.58.2","remark-cli":"^12.0.1","remark-toc":"^9.0.0","typescript":"^5.9.3","@types/node":"^25.4.0","npm-run-all":"^4.1.5","@biomejs/biome":"^2.4.6","@vitest/browser-playwright":"^4.0.18"},"_npmOperationalInternal":{"tmp":"tmp/locutus_3.0.17_1773485106421_0.9438305666627667","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":1773485106675,"_cnpm_publish_time":1773485106675,"dist-tags":{"latest":"3.0.36"}}