diff options
author | Constantin Jucovschi <jucovschi@gmail.com> | 2012-02-26 10:27:56 +0000 |
---|---|---|
committer | Constantin Jucovschi <jucovschi@gmail.com> | 2012-02-26 12:58:57 +0000 |
commit | 1e8ef3bb6af45110001294b3ab70d80955b7f6fc (patch) | |
tree | 2d71ef521749e9d6248a3a74bd9e5ee8a91a8fb1 /static | |
parent | 6467a1a40f5fea7137ec481cfa80681b2258dae8 (diff) | |
download | etherpad-lite-1e8ef3bb6af45110001294b3ab70d80955b7f6fc.zip |
commented general functions
Diffstat (limited to 'static')
-rw-r--r-- | static/js/Changeset.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/static/js/Changeset.js b/static/js/Changeset.js index 715836d5..78066e29 100644 --- a/static/js/Changeset.js +++ b/static/js/Changeset.js @@ -29,12 +29,17 @@ var AttributePoolFactory = require("/AttributePoolFactory"); var _opt = null; -//var exports = {}; +// ==================== General Util Functions ======================= + +// This method is called whenever there is an error in the sync process exports.error = function error(msg) { var e = new Error(msg); e.easysync = true; throw e; }; + +// This method is user for assertions with Messages +// if assert fails, the error function called. exports.assert = function assert(b, msgParts) { if (!b) { var msg = Array.prototype.slice.call(arguments, 1).join(''); @@ -42,12 +47,17 @@ exports.assert = function assert(b, msgParts) { } }; +// Parses a number from string base 36 exports.parseNum = function (str) { return parseInt(str, 36); }; + +// Writes a number in base 36 and puts it in a string exports.numToString = function (num) { return num.toString(36).toLowerCase(); }; + +// Converts stuff before $ to base 10 exports.toBaseTen = function (cs) { var dollarIndex = cs.indexOf('$'); var beforeDollar = cs.substring(0, dollarIndex); @@ -57,6 +67,9 @@ exports.toBaseTen = function (cs) { }) + fromDollar; }; + +// ==================== Changeset Functions ======================= + exports.oldLen = function (cs) { return exports.unpack(cs).oldLen; }; |