{"_id":"morjs","_rev":"7-eb4be036c44ccb9c95ce887d751d618b","name":"morjs","description":"Library for encoding/decoding Morse code messages","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.1":{"name":"morjs","description":"Library for encoding/decoding Morse code messages","version":"1.0.1","homepage":"http://forchoon.com/projects/javascript/mor-js/","bugs":{"url":"https://github.com/neocotic/mor.js/issues"},"author":{"name":"Alasdair Mercer","email":"mercer.alasdair@gmail.com","url":"http://forchoon.com"},"licenses":[{"type":"GPLv3","url":"https://github.com/neocotic/mor.js/raw/master/LICENSE.md"}],"keywords":["decode","encode","fun","util"],"repository":{"type":"git","url":"git://github.com/neocotic/mor.js.git"},"main":"mor.js","ender":"ender.js","_npmUser":{"name":"neocotic","email":"mercer.alasdair@gmail.com"},"_id":"morjs@1.0.1","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.105","_nodeVersion":"v0.4.5","_defaultsLoaded":true,"dist":{"shasum":"936296fc7a6412446dee19e89abe8b29a462220d","tarball":"https://registry.npmjs.org/morjs/-/morjs-1.0.1.tgz","integrity":"sha512-ZoUWfF0bxKCSET7fI5+slfLWMR9ZmxAABR8D4Qw/kjjtm2vk+k9jpCzxVix9J7fKUhk5O6ZbvdF+u5RA07+xug==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBPyNlsGMz2oR7fdvp6v67FlhzXMCvGRoe7IPblzdfI4AiABJy6pcI/TOeoy8C7DPoO2lygnD1kNyRs2YQqEU/I7QA=="}]},"maintainers":[{"name":"neocotic","email":"mercer.alasdair@gmail.com"}]},"1.1.0":{"name":"morjs","version":"1.1.0","description":"Library for encoding/decoding Morse code messages","homepage":"http://neocotic.com/mor.js","bugs":{"url":"https://github.com/neocotic/mor.js/issues"},"author":{"name":"Alasdair Mercer","email":"mercer.alasdair@gmail.com","url":"http://neocotic.com"},"licenses":[{"type":"MIT","url":"https://github.com/neocotic/mor.js/raw/master/LICENSE.md"}],"keywords":["morse","decode","encode","fun","util"],"repository":{"type":"git","url":"git://github.com/neocotic/mor.js.git"},"devDependencies":{"expect.js":"^0.3.1","grunt":"^0.4.5","grunt-contrib-jshint":"^0.10.0","grunt-contrib-uglify":"^0.5.1","grunt-contrib-watch":"^0.6.1","grunt-docco":"^0.3.3","grunt-mocha-test":"^0.11.0"},"main":"mor.js","scripts":{"test":"grunt test"},"gitHead":"73c29b3f7b47439a52e7bd9efe79e05cdcc8cbf0","_id":"morjs@1.1.0","_shasum":"6ce1f7fce42ece62e8ce5114c833997f7e345fb5","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"neocotic","email":"mercer.alasdair@gmail.com"},"maintainers":[{"name":"neocotic","email":"mercer.alasdair@gmail.com"}],"dist":{"shasum":"6ce1f7fce42ece62e8ce5114c833997f7e345fb5","tarball":"https://registry.npmjs.org/morjs/-/morjs-1.1.0.tgz","integrity":"sha512-Owpjihy+RvLvGYlhQK5l6UVStPLLf/6QqMREBQjOrrGX5GOLf6ONfiGaiLzJMiBeuwtubY7ipoLeNW35FGLOSw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCNUtOjVdI2KAflhQ6hkfd5eI+aI4Zp/IxKxwPKu0dRwgIgItJvs3wHaq9D7sKLR4rReEysggL2OpaNzg2lEQoMo2s="}]}}},"maintainers":[{"name":"neocotic","email":"mercer.alasdair@gmail.com"}],"time":{"modified":"2022-06-20T09:30:23.696Z","created":"2011-11-10T22:24:36.378Z","1.0.1":"2011-11-11T00:15:39.620Z","1.1.0":"2014-09-17T21:37:46.939Z"},"author":{"name":"Alasdair Mercer","email":"mercer.alasdair@gmail.com","url":"http://neocotic.com"},"repository":{"type":"git","url":"git://github.com/neocotic/mor.js.git"},"readme":"                                __\n      ___ ___     ___   _ __   /\\_\\    ____\n    /' __` __`\\  / __`\\/\\`'__\\ \\/\\ \\  /',__\\\n    /\\ \\/\\ \\/\\ \\/\\ \\L\\ \\ \\ \\/__ \\ \\ \\/\\__, `\\\n    \\ \\_\\ \\_\\ \\_\\ \\____/\\ \\_\\\\_\\_\\ \\ \\/\\____/\n     \\/_/\\/_/\\/_/\\/___/  \\/_//_/\\ \\_\\ \\/___/\n                               \\ \\____/\n                                \\/___/\n\n[mor.js][0] is a pure JavaScript library for encoding/decoding [Morse code][3] messages that supports extensible\ncharacters and encoding output.\n\n[![Build Status](https://travis-ci.org/neocotic/mor.js.svg?branch=develop)][1]\n[![Dependency Status](https://gemnasium.com/neocotic/mor.js.svg)][4]\n[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)][5]\n\n## Install\n\nInstall using the package manager for your desired environment(s):\n\n``` bash\n# for node.js:\n$ npm install morjs\n# OR; for the browser:\n$ bower install morjs\n```\n\nThis library has no dependencies on any other library.\n\n## Usage\n\nThe API has been completely redesigned to simplify encoding and decoding Morse code messages by simply passing a\nstring to the `encode` and `decode` functions respectively.\n\nIt's important to note that some characters are encoded to the same Morse code sequence (mainly outside of the normal\nalphabet). This also means that, when decoding such messages, the original character is not guaranteed to be matched\nunless it's the first using that sequence. This is not a limitation of this library but of the Morse code language\nitself which did not guarantee uniqueness.\n\nBoth of which also accept an optional `options` parameter which can currently contain the following (all of which are\noptional themselves):\n\n| Option | Description                                  | Default      |\n| ------ | -------------------------------------------- | ------------ |\n| mode   | Mode to be used to encode/decode the message | `\"comptact\"` |\n\n### `encode(message[, options])`\n\nEncodes the `message` parameter using the Morse code.\n\n``` javascript\nconsole.log(morjs.encode('SOS', {mode: 'simple'})); // \"... --- ...\"\n```\n\n### `decode(message[, options])`\n\nDecodes the encoded Morse code `message` parameter.\n\n``` javascript\nconsole.log(morjs.decode('... --- ...', {mode: 'simple'})); // \"SOS\"\n```\n\n### Customization\n\n#### `defaults`\n\nThis is a hash of default values to be applied to the optional `options` parameter and exposed to allow you to override\nany of them.\n\n``` javascript\nmorjs.defaults.mode = 'simple';\n\nconsole.log(morjs.encode('SOS')); // \"... --- ...\"\n```\n\n#### `chars`\n\nA simple map of Unicode characters and their corresponding patterns, which are used when encoding and decoding\nmessages. A pattern is a series of `\"S\"` and `\"L\"` characters representing *short* and *long* respectively.\n\nThe characters are too many to list here but you can find them easily in the source code or when inspecting this value.\n\nAdding support for a new character couldn't be easier. In the following example support for the lambda character is\nadded using a made-up pattern:\n\n``` javascript\nmorjs.chars['\\u039B'] = 'LLLLLSSSSS';\n\nconsole.log(morjs.encode('\\u039B', {mode: 'simple'})); // \"-----.....\"\n```\n\n#### `modes`\n\nModes are key to parsing both encoded and decoded messages as they contain strings used to find and replace patterns in\nthe message. Some of these strings are used to build regular expressions, so it's recommended to familiarized yourself\nwith the usage of modes before creating any custom ones, just so you know on which you need to escape any `RegExp`\nspecial characters.\n\nHere's a list of the built in modes:\n\n- classic\n- classicEntities\n- compact (default)\n- compactEntities\n- simple\n\nAdding a new mode is as simple as the following:\n\n``` javascript\nmorjs.modes.foo = {\n  charSpacer:   '',\n  letterSpacer: ' ',\n  longString:   'F',\n  shortString:  'O',\n  wordSpacer:   '   '\n};\n\nvar options = {mode: 'foo'};\n\nconsole.log(morjs.encode('SOS', options));         // \"OOO FFF OOO\"\nconsole.log(morjs.decode('OOO FFF OOO', options)); // \"SOS\"\n```\n\n### Miscellaneous\n\n#### `noConflict()`\nReturns `morjs` in a no-conflict state, reallocating the `morjs` global variable name to its previous owner, where\npossible.\n\nThis is really just intended for use within a browser.\n\n``` html\n<script src=\"/path/to/conflict-lib.js\"></script>\n<script src=\"/path/to/mor.min.js\"></script>\n<script>\n  var morjsNC = morjs.noConflict();\n  // Conflicting lib works again and use morjsNC for this library onwards...\n</script>\n```\n\n#### `VERSION`\nThe current version of `morjs`.\n\n``` javascript\nconsole.log(morjs.VERSION); // \"1.1.0\"\n```\n\n## Bugs\n\nIf you have any problems with this library or would like to see changes currently in development you can do so\n[here][6].\n\n## Contributors\n\nIf you want to contribute, you're a legend! Information on how you can do so can be found in [CONTRIBUTING.md][8]. We\nwant your suggestions and pull requests!\n\nA list of [mor.js][0] contributors can be found in [AUTHORS.md][7].\n\n## License\n\nCopyright (c) 2014 Alasdair Mercer\n\nSee [LICENSE.md][9] for more information on our MIT license.\n\n[0]: http://neocotic.com/mor.js\n[1]: https://travis-ci.org/neocotic/mor.js\n[2]: https://twitter.com/neocotic\n[3]: https://en.wikipedia.org/wiki/Morse_code\n[4]: https://gemnasium.com/neocotic/mor.js\n[5]: http://gruntjs.com\n[6]: https://github.com/neocotic/mor.js/issues\n[7]: https://github.com/neocotic/mor.js/blob/master/AUTHORS.md\n[8]: https://github.com/neocotic/mor.js/blob/master/CONTRIBUTING.md\n[9]: https://github.com/neocotic/mor.js/blob/master/LICENSE.md","homepage":"http://neocotic.com/mor.js","keywords":["morse","decode","encode","fun","util"],"bugs":{"url":"https://github.com/neocotic/mor.js/issues"},"readmeFilename":"README.md"}