aboutsummaryrefslogtreecommitdiff
path: root/js/commonjs/export_asserts.js
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2016-02-04 10:38:06 -0800
committerJosh Haberman <jhaberman@gmail.com>2016-02-18 10:30:21 -0800
commit9e60036c1b1db947d29cbaaa668aeae19e7d2068 (patch)
treea4803ea2a242988c543710f4b6979771a59b0f87 /js/commonjs/export_asserts.js
parente9f31ee3d7cf7c0f370607e54dbea01ba7240a77 (diff)
downloadprotobuf-9e60036c1b1db947d29cbaaa668aeae19e7d2068.tar.gz
protobuf-9e60036c1b1db947d29cbaaa668aeae19e7d2068.tar.bz2
protobuf-9e60036c1b1db947d29cbaaa668aeae19e7d2068.zip
Moved CommonJS-specific files to commonjs/.
Diffstat (limited to 'js/commonjs/export_asserts.js')
-rw-r--r--js/commonjs/export_asserts.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/js/commonjs/export_asserts.js b/js/commonjs/export_asserts.js
new file mode 100644
index 00000000..16abdd7d
--- /dev/null
+++ b/js/commonjs/export_asserts.js
@@ -0,0 +1,27 @@
+/**
+ * @fileoverview Description of this file.
+ */
+
+goog.require('goog.testing.asserts');
+
+var global = Function('return this')();
+
+// The Google Closure assert functions start with assert, eg.
+// assertThrows
+// assertNotThrows
+// assertTrue
+// ...
+//
+// The one exception is the "fail" function.
+function shouldExport(str) {
+ return str.lastIndexOf('assert') === 0 || str == 'fail';
+}
+
+for (var key in global) {
+ if ((typeof key == "string") && global.hasOwnProperty(key) &&
+ shouldExport(key)) {
+ exports[key] = global[key];
+ }
+}
+
+exports.COMPILED = COMPILED