Skip to content
bookmarkletter convert your code to bookmarklets.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
test
.gitignore
.travis.yml
CHANGELOG.md
README.md
index.js
package.json

README.md

bookmarkletter

bookmarkletter convert code to bookmarklets

Installation

npm install bookmarkletter -g

Usage

$ bookmarkletter code.js
# or
$ cat code.js | bookmarkletter

Output => javascript:(function(){ ...code... })()

API

bookmarkletter allow to use as node module.

npm install bookmarkletter

Use as module

var bookmarkletter = require("bookmarkletter").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

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

Acknowledgements

Thanks to chriszarate/bookmarkleter

You can’t perform that action at this time.