Skip to content

Commit

Permalink
fix: merge tagged values with direct values
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Jun 5, 2017
1 parent 4737124 commit ac03e5d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/utilities/mapTaggedTemplateLiteralInvocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ import type {
} from '../types';

export default (targetMethod: *) => {
return (maybeQuery: string | TaggledTemplateLiteralInvocationType, values?: DatabaseQueryValuesType) => {
return (maybeQuery: string | TaggledTemplateLiteralInvocationType, values: DatabaseQueryValuesType = []) => {
if (typeof maybeQuery === 'string') {
return targetMethod(maybeQuery, values);
} else {
return targetMethod(maybeQuery.sql, [
...maybeQuery.values,
values
]);
return targetMethod(maybeQuery.sql, maybeQuery.values.concat(values));
}
};
};

0 comments on commit ac03e5d

Please sign in to comment.