Skip to content

Commit

Permalink
doc(js.md): supplement parameters description (#2780) (#2781)
Browse files Browse the repository at this point in the history
  • Loading branch information
hooozen authored Mar 30, 2023
1 parent e8ea8ca commit 5ed3ea7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/docs/js.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ stylus(str)
});
```

## .define(name, node)
## .define(name, node[, raw])

By passing a `Node`, we may define a global variable. This is useful when exposing conditional features within your library depending on the availability of another. For example the **Nib** extension library conditionally supports node-canvas, providing image generation.

Expand All @@ -89,6 +89,8 @@ Stylus also casts JavaScript values to their Stylus equivalents when possible. H
.define('families', ['Helvetica Neue', 'Helvetica', 'sans-serif'])
```

Note: In default, The JavaScript object variable will coerce to a tuple-array-like expression. For example `{ foo: 'bar', bar: 'baz' }` would become the expression `(foo 'bar') (bar 'baz')`. If you want to get a [hash object](https://stylus-lang.com/docs/hashes.html) return, please set `raw` to `true`.

These same rules apply to return values in js functions as well:

```js
Expand Down

0 comments on commit 5ed3ea7

Please sign in to comment.