Files
30-seconds-of-code/static-parts/README-start.md
2018-01-04 01:28:28 +11:00

2.3 KiB

Logo

30 seconds of code

License Gitter chat PRs Welcome Travis Build Insight.io js-semistandard-style ProductHunt

Curated collection of useful Javascript snippets that you can understand in 30 seconds or less.

  • Use Ctrl + F or command + F to search for a snippet.
  • Contributions welcome, please read the contribution guide.
  • Snippets are written in ES6, use the Babel transpiler to ensure backwards-compatibility.
  • You can import these snippets into your text editor of choice (VSCode, Atom, Sublime) using the files found in this repo.
  • You can import these snippets into Alfred 3, using this file.

Package

You can find a package with all the snippets on npm.

npm install 30-seconds-of-code

⚠️ WARNING: Snippets are not production ready.

To import the whole module:

// CommonJS
const _30s = require('30-seconds-of-code');
_30s.average(1, 2, 3);

// ES Modules
import _30s from '30-seconds-of-code';
_30s.average(1, 2, 3);

To import snippets directly:

// CommonJS
const { average } = require('30-seconds-of-code');
average(1, 2, 3);

// ES Modules
import { average } from '30-seconds-of-code';
average(1, 2, 3);

Table of Contents