aboutsummaryrefslogtreecommitdiff
path: root/src/utility.js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-12-25 12:28:30 -0800
committerAlon Zakai <azakai@mozilla.com>2010-12-25 12:28:30 -0800
commit8e5c52df194f951187e897e5213849828e41b490 (patch)
tree4f42c35f387cf5553893fa8db58299330bf582bd /src/utility.js
parent7985433ea6d2beb324f8ae7cd653407376955555 (diff)
code cleanup
Diffstat (limited to 'src/utility.js')
-rw-r--r--src/utility.js48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/utility.js b/src/utility.js
index ce726fbe..6973362d 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -1,4 +1,5 @@
-// General JS utilities
+// General JS utilities - things that might be useful in any JS project.
+// Nothing specific to Emscripten appears here.
function safeQuote(x) {
return x.replace(/"/g, '\\"')
@@ -90,15 +91,6 @@ function zeros(size) {
return ret;
}
-function searchable() {
- if (typeof arguments[0] === 'object') arguments = arguments[0];
- var ret = {};
- for (var i = 0; i < arguments.length; i++) {
- ret[arguments[i]] = 0;
- }
- return ret;
-}
-
function walkJSON(item, func) {
if (item.length) {
for (var x = 0; x < item.length; x++) {
@@ -204,9 +196,30 @@ function mergeInto(obj, other) {
return obj;
}
+function isNumber(x) {
+ return x == parseFloat(x);
+}
+
+function flatten(x) {
+ if (typeof x !== 'object') return x;
+ var ret = [];
+ for (var i = 0; i < x.length; i++) {
+ ret = ret.concat(flatten(x[i]));
+ }
+ return ret;
+}
+
// Sets
-set = searchable; // Create a 'set'
+function set() {
+ if (typeof arguments[0] === 'object') arguments = arguments[0];
+ var ret = {};
+ for (var i = 0; i < arguments.length; i++) {
+ ret[arguments[i]] = 0;
+ }
+ return ret;
+}
+
function setSub(x, y) {
var ret = set(values(x));
for (yy in y) {
@@ -228,16 +241,3 @@ function setIntersect(x, y) {
return ret;
}
-function isNumber(x) {
- return x == parseFloat(x);
-}
-
-function flatten(x) {
- if (typeof x !== 'object') return x;
- var ret = [];
- for (var i = 0; i < x.length; i++) {
- ret = ret.concat(flatten(x[i]));
- }
- return ret;
-}
-