Skip to content

Instantly share code, notes, and snippets.

@eirikb
Last active August 29, 2015 14:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eirikb/407497a7c3830e635e0a to your computer and use it in GitHub Desktop.
Save eirikb/407497a7c3830e635e0a to your computer and use it in GitHub Desktop.
nodify
var nodify = require('nodify');
// Prints build time
console.log(nodify(function() {
return new Date();
}));
// Prints current time
console.log(new Date());
var built = new Date(nodify(function () {
return Date.now();
}));
var builtBy = nodify(function (require) {
var parts = process.env['USERPROFILE'].split(require('path').sep);
return ('' + parts[parts.length - 1]).trim().toLowerCase();
});
// ...
bundler.transform('nodify');
// ...
var staticModule = require('static-module');
module.exports = function () {
return staticModule({
nodify: function (cb) {
return "JSON.parse('" + JSON.stringify(cb(require)) + "')";
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment