Skip to content

Commit

Permalink
Refactor optToSTring to handle boolean options properly
Browse files Browse the repository at this point in the history
  • Loading branch information
jcollado committed Sep 23, 2015
1 parent a7ad864 commit 34509a0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,14 @@ function attrToString(attrName, opts) {
* @returns {string} Option string representation
*/
function optToString(opt, value) {
if (opt === 'primaryKey') {
return 'primaryKey';
}

if (optToString.knownOptions.has(opt)) {
if (typeof(value) == 'boolean') {
return opt;
}
return opt + ': ' + value;
}
}
optToString.knownOptions = new Set(['description', 'type']);
optToString.knownOptions = new Set(['primaryKey', 'description', 'type']);

Object.defineProperty(ModelRenderer.prototype, 'metadata', {
get: function () {
Expand Down

0 comments on commit 34509a0

Please sign in to comment.