bookmarkletter
v0.1.1
Published
Create bookmarklet from your js or input
Readme
bookmarkletter
bookmarkletter convert code to bookmarklets
Installation
npm install bookmarkletter -gUsage
$ bookmarkletter code.js
# or
$ cat code.js | bookmarkletterOutput => javascript:(function(){ ...code... })()
API
bookmarkletter allow to use as node module.
npm install bookmarkletterUse as module
var bookmarkletter = require("bookmarkletter");
var code = "var a = 1;";
var result = bookmarkletter(code);
assert.equal(result, "javascript:(function(){var%20a=1}())");Options
bookmarkletter's options
var options = {
// @type {string} prefix string of compiled code
// Default : `javascript:`
"prefix-string": "javascript:",
// @type {boolean} Add IIFE wrapper, if true
// Default : `true`
"wrap-anonymous-function": true
};
var code = "var a = 1;";
var result = bookmarkletter(code, options);
assert.equal(result, "javascript:(function(){var%20a=1}())");Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
License
MIT
Acknowledgements
Thanks to chriszarate/bookmarkleter
