Skip to content

Commit

Permalink
fix: add type safety check
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Jul 29, 2018
1 parent 12aa9e9 commit b154427
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/index.js
Expand Up @@ -101,7 +101,15 @@ const sql = (parts: $ReadOnlyArray<string>, ...values: $ReadOnlyArray<Anonymouse
}

if (value && Array.isArray(value.names) && value.type === 'IDENTIFIER') {
raw += value.names.map(escapeIdentifier).join('.');
raw += value.names
.map((identifierName) => {
if (typeof identifierName !== 'string') {
throw new TypeError('Identifier name must be a string.');
}

return escapeIdentifier(identifierName);
})
.join('.');

// eslint-disable-next-line no-continue
continue;
Expand Down

0 comments on commit b154427

Please sign in to comment.