Simplify Node.js API
This commit is contained in:
parent
89567988cf
commit
9ee904fdc0
|
@ -85,9 +85,7 @@ yarn add hyperbuild
|
|||
```js
|
||||
const hyperbuild = require("hyperbuild");
|
||||
|
||||
const code = Buffer.from("<p> Hello, world! </p>");
|
||||
const len = hyperbuild.minify(code);
|
||||
const minified = code.slice(0, len).toString();
|
||||
const minified = hyperbuild.minify("<p> Hello, world! </p>");
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
|
@ -1 +1,10 @@
|
|||
module.exports = require('../native');
|
||||
const hyperbuild = require('../native');
|
||||
|
||||
module.exports = {
|
||||
minify: code => {
|
||||
const buf = Buffer.from(code);
|
||||
const len = hyperbuild.minify(buf);
|
||||
return buf.slice(0, len).toString();
|
||||
},
|
||||
minify_in_place: hyperbuild.minify,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue