Commit 4f6b5e11 authored by Tristan Cavelier's avatar Tristan Cavelier

splitstorage.js amd compatible now

parent 42953eed
...@@ -16,23 +16,15 @@ ...@@ -16,23 +16,15 @@
* "storage_list": [<storage description>, ...] * "storage_list": [<storage description>, ...]
* } * }
*/ */
(function () { // define([module_name], [dependencies], module);
(function (dependencies, module) {
"use strict"; "use strict";
if (typeof define === 'function' && define.amd) {
var queries; return define(dependencies, module);
/**
* Get the real type of an object
*
* @param {Any} value The value to check
* @return {String} The value type
*/
function type(value) {
// returns "String", "Object", "Array", "RegExp", ...
return (/^\[object ([a-zA-Z]+)\]$/).exec(
Object.prototype.toString.call(value)
)[1];
} }
module(jIO);
}(['jio'], function (jIO) {
"use strict";
/** /**
* Generate a new uuid * Generate a new uuid
...@@ -299,7 +291,7 @@ ...@@ -299,7 +291,7 @@
} }
}; };
} }
if (type(doc) !== "Array") { if (!Array.isArray(doc)) {
for (i = 0; i < priv.storage_list.length; i += 1) { for (i = 0; i < priv.storage_list.length; i += 1) {
that.addJob( that.addJob(
method, method,
...@@ -592,20 +584,5 @@ ...@@ -592,20 +584,5 @@
return that; return that;
} // end of splitStorage } // end of splitStorage
//////////////////////////////
// exports to JIO
if (typeof define === "function" && define.amd) {
define(['jio'], function (jio) {
try {
queries = require('complex_queries');
} catch (e) {}
jio.addStorageType('split', splitStorage);
});
} else if (typeof require === "function") {
require('jio').addStorageType('split', splitStorage);
} else if (typeof jIO === "object") {
jIO.addStorageType('split', splitStorage); jIO.addStorageType('split', splitStorage);
} else { }));
throw new Error("Unable to export splitStorage to JIO.");
}
}());
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment