Curated collection of useful JavaScript snippets that can be understood in 30 seconds or less. The npm package provides a function library with over 200+ snippets covering array, object, string, utility, and DOM operations. Current stable version is v14.0.0 as of recent releases, with a major infrastructure overhaul. Key differentiators: snippets are small, self-contained, and educational; package is published on npm and CDN; includes both CommonJS and ESM support. The library is maintained by the 30-seconds organization and has a vibrant community with multiple related projects.
npm install 30-seconds-of-codeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import and use the library via ESM, CommonJS, and CDN with a simple average function.
Use TypeScript with caution; check snippet documentation for type changes.
Use named imports to tree-shake in bundlers like Webpack or Rollup.
Review snippet disclaimers before using in production code.
Use CommonJS require for Node <12 or transpile with Babel.
Run 'npm install 30-seconds-of-code' and ensure import is correct.
Use _30s.default.average or import named functions directly.
Ensure package is in node_modules and bundler is configured correctly.
No dependency data recorded yet.