Skip to content

Commit

Permalink
fix(deprecate): Make deprecate accept conditional argument (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
bantic authored Sep 6, 2016
1 parent 68a60ae commit 059fd66
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/js/utils/deprecate.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
export default function deprecate(message) {
console.log(`[mobiledoc-kit] [DEPRECATED]: ${message}`); // jshint ignore:line
/**
* Usage:
* Without a conditional, always prints deprecate message:
* `deprecate('This is deprecated')`
*
* Conditional deprecation, works similarly to `assert`, prints deprecation if
* conditional is false:
* `deprecate('Deprecated only if foo !== bar', foo === bar)`
*/
export default function deprecate(message, conditional=false) {
if (!conditional) {
console.log(`[mobiledoc-kit] [DEPRECATED]: ${message}`); // jshint ignore:line
}
}

0 comments on commit 059fd66

Please sign in to comment.