2.0.0 • Published 7 years ago

bookmarkleted v2.0.0

Weekly downloads
7
License
-
Repository
-
Last release
7 years ago

bookmarkleted

Encoding and decoding for bookmarklets.

Home | MIT License | v2.0.0

Bookmarklets don't need to be a mess. The key is insulating yourself from what the browser stores with an encode/decode step. That's what bookmarkleted provides. bookmarkleted encode transforms a normal JS file into a bookmarklet, bookmarkleted decode recovers the original file. Your input file doesn't need to deal with bookmarklet quirks like URI-encoding or the implicit document.write, and is also put in its own namespace, put in strict mode, and made to alert uncaught errors.

Setup

npm install --global bookmarkleted

CLI

bookmarkleted encode

Encodes stdin, outputs to stdout.

bookmarkleted decode

Decodes stdin, outputs to stdout. Only works on bookmarklets created using this library.

API

bookmarkleted.encode(sourceCode: string): string

Encodes sourceCode, returns the result.

bookmarkleted.decode(bookmarklet: string): string

Decodes bookmarklet, returns the result. Only works on bookmarklets created using this library.