query
On this page

writeJS

pkgs.writers.writeJS

Functor
Docs pulled from | This Revision | about 8 hours ago


writeJS takes a name an attributeset with libraries and some JavaScript sourcecode and returns an executable

Inputs

name

1. Function argument

attrs

2. Function argument

content

3. Function argument

Examples

pkgs.writers.writeJS usage example

writeJS "example" { libraries = [ pkgs.uglify-js ]; } ''
  var UglifyJS = require("uglify-js");
  var code = "function add(first, second) { return first + second; }";
  var result = UglifyJS.minify(code);
  console.log(result.code);
''

Noogle also knows

This is a Functor

Learn about functors