Commit e6592c8b authored by Patricio Bruna's avatar Patricio Bruna

Removed jquery and build for nodejs support

parent bc10301c
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
.travis.yml .travis.yml
.editorconfig .editorconfig
test/ test/
src/
bower.json bower.json
Makefile Makefile
server.js server.js
......
This diff is collapsed.
This diff is collapsed.
{ {
"name": "zimbra-admin-api-js", "name": "zimbra-admin-api-js",
"version": "0.1.6", "version": "0.2.0",
"main": "lib/zimbra-admin-api.js", "main": "src/index.js",
"dependencies": { "dependencies": {
"crypto-browserify": "^3.11.0", "crypto-browserify": "^3.11.0",
"jquery": "^2.2.3", "js-zimbra": "github:zboxapp/js-zimbra",
"js-zimbra": "github:zboxapp/js-zimbra#super-agent",
"merge": "^1.2.0", "merge": "^1.2.0",
"options-api": "^1.1.0", "options-api": "^1.1.0",
"sprintf-js": "^1.0.3", "sprintf-js": "^1.0.3",
......
...@@ -28,7 +28,7 @@ export default class Dictionary { ...@@ -28,7 +28,7 @@ export default class Dictionary {
// Takes an object an return an array // Takes an object an return an array
// {size: 20, age: 30} => [ {n: size, _content: 20}, {n: age, _content: 30}] // {size: 20, age: 30} => [ {n: size, _content: 20}, {n: age, _content: 30}]
attributesToArray (attributes) { attributesToArray (attributes) {
if ($.isEmptyObject(attributes)) return []; if (this.isEmptyObject(attributes)) return [];
const result = []; const result = [];
const map = new Map(Object.entries(attributes)); const map = new Map(Object.entries(attributes));
map.forEach((key, value) => { map.forEach((key, value) => {
...@@ -105,6 +105,24 @@ export default class Dictionary { ...@@ -105,6 +105,24 @@ export default class Dictionary {
return result; return result;
} }
isEmptyObject(obj) {
// null and undefined are "empty"
if (obj === null) return true;
// Assume if it has a length property with a non-zero value
// that that property is correct.
if (obj.length > 0) return false;
if (obj.length === 0) return true;
// Otherwise, does it have any properties of its own?
// Note that this doesn't handle
// toString and valueOf enumeration bugs in IE < 9
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) return false;
}
return true;
}
resourceResponseName (resource) { resourceResponseName (resource) {
return this.zimbra_resources[resource.toLowerCase()].response_name; return this.zimbra_resources[resource.toLowerCase()].response_name;
} }
......
...@@ -745,17 +745,4 @@ ...@@ -745,17 +745,4 @@
}); });
}); });
describe('Timeout Error tests', function() {
this.timeout(5000);
it('should create and return an account', function(done){
let api = new ZimbraAdminApi(auth_data);
api.client.options.timeout = 100;
api.getAllAccounts(function(err, data){
expect(err).to.exist;
done();
});
});
});
})(); })();
...@@ -48,11 +48,7 @@ var config = { ...@@ -48,11 +48,7 @@ var config = {
}, },
{ {
test: /(node_modules)\/.+\.(js|jsx)$/, test: /(node_modules)\/.+\.(js|jsx)$/,
loader: 'imports', loader: 'imports'
query: {
$: 'jquery',
jQuery: 'jquery'
}
} }
] ]
}, },
......
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