Skip to content

Commit

Permalink
Fixed module and fromString is now sync func
Browse files Browse the repository at this point in the history
  • Loading branch information
Malte Legenhausen committed Aug 8, 2012
1 parent 41560db commit 6b239d8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ or directly from a string:
```
var htmlToText = require('html-to-text');
htmlToText.fromString('<h1>Hello World</h1>', {
var text = htmlToText.fromString('<h1>Hello World</h1>', {
wordwrap: 130
}, function(err, text) {
if (err) return console.error(err);
console.log(text);
});
console.log(text);
```

### Options:
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
exports = require('./lib/html-to-text');
module.exports = require('./lib/html-to-text');
5 changes: 2 additions & 3 deletions lib/html-to-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,10 @@ exports.fromFile = function(file, options, callback) {
});
};

exports.fromString = function(str, options, callback) {
exports.fromString = function(str, options) {
if (!callback) {
callback = options;
options = {};
}
var result = htmlToText(str, options);
return callback(null, result);
return htmlToText(str, options);
};

0 comments on commit 6b239d8

Please sign in to comment.