diff --git a/lib/assert.js b/lib/assert.js new file mode 100644 index 00000000..1b769472 --- /dev/null +++ b/lib/assert.js @@ -0,0 +1,6 @@ +this.assert = function(condition, message) { + if (!condition) { + console.error(message); + throw new Error; + } +} diff --git a/lib/stroke_extractor.js b/lib/stroke_extractor.js index a933c475..355ac20a 100644 --- a/lib/stroke_extractor.js +++ b/lib/stroke_extractor.js @@ -3,14 +3,6 @@ var MIN_CORNER_ANGLE = 0.1*Math.PI; var MIN_CORNER_TANGENT_DISTANCE = 4; var REVERSAL_PENALTY = 0.5; -// Error out if the condition does not hold. -function assert(condition, message) { - if (!condition) { - console.error(message); - throw new Error; - } -} - // Helper methods for use with angles, which are floats in [-pi, pi). var Angle = { subtract: function(angle1, angle2) { @@ -28,7 +20,7 @@ var Angle = { }, }; -// Helper methods for use with "points", which are just pairs of integers. +// Helper methods for use with "points", which are pairs of integers. var Point = { angle: function(point) { return Math.atan2(point[1], point[0]); diff --git a/server/migration.js b/server/migration.js index a0933af4..f3825131 100644 --- a/server/migration.js +++ b/server/migration.js @@ -1,10 +1,3 @@ -function assert(condition, message) { - if (!condition) { - console.log(message); - throw new Error; - } -} - function get_final_bridges(glyph, original_bridges) { var set = {}; var result = original_bridges.concat(glyph.manual.bridges_added);