Skip to content

Commit

Permalink
Uint8Array data (e.g. Postgres "bytea" type) erroneously considered "…
Browse files Browse the repository at this point in the history
…undefined" by recent 0.11.7 update. (#1601)

* Made modification so that attributes with data stored in typed arrays such as Uint8Arrays are treated as "Arrays" vs as "Objects". For example, pgsql "bytea" type column data is passed back as Uint8Arrays by the node pgsql driver "pg" and without this modification, such data will fail the "containsUndefined" test.

* Made modification so that attributes with data stored in typed arrays such as Uint8Arrays are automatically treated as "not undefined" (vs as "Array" which will result in unecessary testing of Array contents). For example, pgsql "bytea" type column data is passed back as Uint8Arrays by the node pgsql driver "pg" and without this modification, such data will fail the "containsUndefined" test with previous implementation.
  • Loading branch information
mashaalmemon authored and rhys-vdw committed Jul 31, 2016
1 parent 751ab2a commit 831ba2f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/helpers.js
@@ -1,6 +1,6 @@
/* eslint no-console:0 */

import { map, pick, keys, isFunction, isUndefined, isObject, isArray } from 'lodash'
import { map, pick, keys, isFunction, isUndefined, isObject, isArray, isTypedArray } from 'lodash'
import chalk from 'chalk';

// Pick off the attributes from only the current layer of the object.
Expand Down Expand Up @@ -47,6 +47,9 @@ export function exit(msg) {
export function containsUndefined(mixed) {
let argContainsUndefined = false;

if (isTypedArray(mixed))
return false;

if(mixed && isFunction(mixed.toSQL)) {
//Any QueryBuilder or Raw will automatically be validated during compile.
return argContainsUndefined;
Expand Down

0 comments on commit 831ba2f

Please sign in to comment.