postcss-message-helpers
Advanced tools
Comparing version
@@ -0,3 +1,7 @@ | ||
# 1.1.0 - 2014-11-24 | ||
- `try` now returns the result of the callback | ||
# 1.0.0 - 2014-11-24 | ||
First release |
@@ -48,3 +48,3 @@ /** | ||
try { | ||
fn() | ||
return fn() | ||
} | ||
@@ -51,0 +51,0 @@ catch (err) { |
{ | ||
"name": "postcss-message-helpers", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "PostCSS helpers to throw or output GNU style messages", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -13,4 +13,24 @@ # postcss-message-helpers [](https://travis-ci.org/postcss/postcss-message-helpers) | ||
```js | ||
var messageHelpers = require("postcss-message-helpers") | ||
``` | ||
## Usage | ||
### `var fnValue = messageHelpers.try(fn, source)` | ||
Execute `fn` an return the value. | ||
If an exception is thrown during the process, the exception will be catched, enhanced from source & re-throw. | ||
### `var sourceMessage = messageHelpers.message(message, source)` | ||
Returns a message like `sourcefile:lineno:column: message`. | ||
`source` should be a postcss source object from a node. | ||
### `var source = messageHelpers.source(source)` | ||
Returns `sourcefile:lineno:column` for a given `source` postcss object. | ||
### Example | ||
```js | ||
@@ -17,0 +37,0 @@ // dependencies |
5837
12.81%81
32.79%