Semify

semify is the first of two tiny libraries I’ve released on npm. The reasoning behind it’s simple I’d rather not use semicolons but browserify would prefer I did. This small transform keeps us both happy by piggy-backing onto the hard work done both by semi and browserify-transform-tools.

To use:

$ npm install --save @artcommacode/semify
$ browserify -t @artcommacode/semify main.js

The module itself is only 12 lines long:

var semi = require('semi')
var util = require('util')
var transform = require('browserify-transform-tools').makeStringTransform
var options = {includeExtensions: ['.js']}

semi.on('error', function (error) {
  throw new Error(util.format('%s at %d:%d', error.message, error.line, error.column))
})

module.exports = transform("semify", options, function (content, _, done) {
  done(null, semi.add(content))
})

For further information, see the semify page on npm.