-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(deprecate): Make deprecate accept conditional argument (#488)
- Loading branch information
Showing
1 changed file
with
13 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |