Review fixes
This commit is contained in:
parent
da5e1b2b57
commit
32a5cfe584
|
@ -4,6 +4,7 @@ define(function(require) {
|
|||
var WSQL_VERSION = require('src/constants').WSQL_VERSION;
|
||||
var WSQL_SIZE = require('src/constants').WSQL_SIZE;
|
||||
var WSQL_DESC = require('src/constants').WSQL_DESC;
|
||||
var u8toArray = require('src/shared').u8toArray;
|
||||
|
||||
function WebSQLContext(db, isReadOnly) {
|
||||
var that = this;
|
||||
|
@ -62,14 +63,7 @@ define(function(require) {
|
|||
if(Object.prototype.toString.call(value) === "[object Uint8Array]") {
|
||||
value = {
|
||||
__isUint8Array: true,
|
||||
__array: (function() {
|
||||
var array = [];
|
||||
var vlen = value.length;
|
||||
for(var i = 0; i < vlen; i++) {
|
||||
array[i] = value[i];
|
||||
}
|
||||
return array;
|
||||
}())
|
||||
__array: u8toArray(value)
|
||||
};
|
||||
}
|
||||
value = JSON.stringify(value);
|
||||
|
|
|
@ -15,9 +15,22 @@ define(function(require) {
|
|||
|
||||
function nop() {}
|
||||
|
||||
/**
|
||||
* Convert a Uint8Array to a regular array
|
||||
*/
|
||||
function u8toArray(u8) {
|
||||
var array = [];
|
||||
var len = u8.length;
|
||||
for(var i = 0; i < len; i++) {
|
||||
array[i] = u8[i];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
return {
|
||||
guid: guid,
|
||||
hash: hash,
|
||||
u8toArray: u8toArray,
|
||||
nop: nop
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue