pull/1/merge
Joseph Finlayson 10 years ago
commit 6c7a90b90c

1
.gitignore vendored

@ -0,0 +1 @@
node_modules

@ -1,7 +1,7 @@
{
"name": "js-md2",
"version": "0.2.0",
"main": ["build/md2.min.js"],
"version": "0.2.1",
"main": ["src/md2.js"],
"ignore": [
"samples",
"tests"

@ -3,17 +3,28 @@
* https://github.com/emn178/js-md2
*
* Copyright 2014-2015, emn178@gmail.com
* Copyright 2015, joseph.finlayson@gmail.com
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
;(function(root, undefined) {
;
(function (root, undefined) {
'use strict';
var NODE_JS = typeof(module) != 'undefined';
var NODE_JS = typeof window === 'undefined';
if (NODE_JS) {
root = global;
}
// Note that for maximum portability, libraries that are not jQuery should
// declare themselves as anonymous modules, and avoid setting a global if an
// AMD loader is present. jQuery is a special case. For more information, see
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
var HEX_CHARS = '0123456789abcdef'.split('');
var S = [0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13,
@ -56,14 +67,17 @@
code = message.charCodeAt(index);
if (code < 0x80) {
M[i++] = code;
} else if (code < 0x800) {
}
else if (code < 0x800) {
M[i++] = 0xc0 | (code >> 6);
M[i++] = 0x80 | (code & 0x3f);
} else if (code < 0xd800 || code >= 0xe000) {
}
else if (code < 0xd800 || code >= 0xe000) {
M[i++] = 0xe0 | (code >> 12);
M[i++] = 0x80 | ((code >> 6) & 0x3f);
M[i++] = 0x80 | (code & 0x3f);
} else {
}
else {
code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
M[i++] = 0xf0 | (code >> 18);
M[i++] = 0x80 | ((code >> 12) & 0x3f);
@ -142,7 +156,14 @@
if (!root.JS_MD2_TEST && NODE_JS) {
module.exports = md2;
} else if(root) {
}
else if (typeof define === "function" && define.amd) {
define("md2", [], function () {
return md2;
});
}
else if (root) {
root.md2 = md2;
}
}(this));

Loading…
Cancel
Save