update docs

This commit is contained in:
Leo Horie 2016-06-20 09:22:00 -04:00
parent b9ce90765d
commit ce0c30a235
11 changed files with 849 additions and 236 deletions

View file

@ -25,10 +25,23 @@ Sometimes non-native types may appear to indicate that a specific object signatu
The **Required** column indicates whether an argument is required or optional. If an argument is optional, you may set it to `null` or `undefined`, or omit it altogether, such that the next argument appears in its place.
---
### Splats
A splat argument means that if the last argument is an array, you can omit the square brackets and have a variable number of arguments in the method instead.
A splat argument means that if the argument is an array, you can omit the square brackets and have a variable number of arguments in the method instead.
In the example at the top, this means that `m("div", {id: "foo"}, ["a", "b", "c"])` can also be written as `m("div", {id: "foo"}, "a", "b", "c")`.
Splats are useful in some compile-to-js languages such as Coffeescript, and also allow helpful shorthands for some common use cases.
Splats are useful in some compile-to-js languages such as Coffeescript, and also allow helpful shorthands for some common use cases.
---
### Function signatures
Functions are denoted with an arrow (`->`). The left side of the arrow indicates the types of the input arguments and the right side indicates the type for the return value.
For example, `parseFloat` has the signature `String -> Number`, i.e. it takes a string as input and returns a number as output.
Functions with multiple arguments are denoted with parenthesis: `String, Array -> Number`