Socket
Socket
Sign inDemoInstall

aqb

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aqb - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

26

index.js

@@ -7,3 +7,2 @@ /*jshint browserify: true */

types = require('./types'),
QB = {},
toArray,

@@ -26,2 +25,27 @@ warn;

function QB(obj) {
if (typeof obj === 'string') {
return QB.str(obj);
}
if (obj === null || obj === undefined) {
return new types.NullLiteral();
}
if (typeof obj === 'object') {
if (obj instanceof Date) {
return QB(JSON.stringify(obj));
}
if (obj instanceof Array) {
return new types.ListLiteral(obj.map(QB));
}
var result = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
result[key] = QB(obj[key]);
}
}
return new types.ObjectLiteral(result);
}
return types.autoCastToken(obj);
}
Object.keys(types._PartialStatement.prototype).forEach(function (key) {

@@ -28,0 +52,0 @@ if (key === 'constructor') return;

2

package.json
{
"name": "aqb",
"version": "1.7.0",
"version": "1.8.0",
"description": "ArangoDB AQL query builder.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -63,2 +63,18 @@ # ArangoDB Query Builder

## Auto-casting raw data
By default, the query builder will attempt to interpret raw strings as identifiers or references or other kinds of expressions. This may not always be what you want, especially when handling raw untrusted data.
As of version 1.8 you can now pass arbitrary data directly to the query builder itself and it will be translated to the equivalent AQL structure (e.g. strings will be strings, dates will be converted to JSON, arrays and objects will be translated recursively, and so on):
```js
var doc = {
aString: "hello",
aDate: new Date(),
aNumber: 23,
anArray: [1, 2, 3, "potato"]
};
db._query(qb.insert(qb(doc)).into('my_collection'));
```
## AQL Types

@@ -65,0 +81,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc