If, for no apparent reason, you want to read some excerpts with emojis in between, here are some of the many gems in that little document:
- A function that is part of the public API takes 0-2 required arguments, plus (if necessary) an options object (so max 3 total).
Optional parameters should generally go into the options object.
The 'options' argument is the only argument that is a regular 'Object'.
Other arguments can be objects, but they must be distinguishable from a 'plain' Object at runtime, by having either:
- a distinguishing prototype (e.g.
- a well-known symbol property (e.g. an iterable with
This allows the API to evolve in a backwards compatible way, even when the position of the options object changes.
Be explicit even when it means more code.
Do not document function arguments unless they are non-obvious in their intent (though if they are non-obvious, the API should be reconsidered anyways). Therefore @param should generally not be used.
Code examples should not contain additional comments. It is already inside a comment. If it needs further comments it isn't a good example.
If you want to steal it for your project, this is where the markdown lives.
Disclaimer: The author is not affiliated with the deno project or its authors. Copyright of all images belongs to their respective owners.