Skip to content

Commit

Permalink
Only warn once
Browse files Browse the repository at this point in the history
  • Loading branch information
surma committed Mar 15, 2021
1 parent bf0c536 commit c74f88e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/asbind-instance/bind-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,19 @@ const converters = new Map([
]
]);

const warned = new Set();
function getConverterForType(typeName) {
for (const [matcher, converter] of converters) {
if (matcher.test(typeName)) {
return converter;
}
}
console.warn(
`No converter for ${JSON.stringify(typeName)}, using pass-through`
);
if (!warned.has(typeName)) {
console.warn(
`No converter for ${JSON.stringify(typeName)}, using pass-through`
);
warned.add(typeName);
}
return { ascToJs: nop, jsToAsc: nop };
}

Expand Down

0 comments on commit c74f88e

Please sign in to comment.