aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-03-28 19:18:54 +0200
committerGitHub <[email protected]>2022-03-28 19:18:54 +0200
commit8ab5effbfac0c0f00afb20881e01e14ecb19e569 (patch)
tree68d58606a78face689d05836ec577d20e653944e /src/internal
parent94c96ba0dd69cf20bff63bdc64b4790c752ebd5d (diff)
downloadfaker-8ab5effbfac0c0f00afb20881e01e14ecb19e569.tar.xz
faker-8ab5effbfac0c0f00afb20881e01e14ecb19e569.zip
chore: use a standardized deprecated function (#689)
Co-authored-by: pkuczynski <[email protected]>
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/deprecated.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/internal/deprecated.ts b/src/internal/deprecated.ts
new file mode 100644
index 00000000..7f20c24f
--- /dev/null
+++ b/src/internal/deprecated.ts
@@ -0,0 +1,29 @@
+/* eslint-disable jsdoc/check-tag-names */
+/* eslint-disable jsdoc/require-param */
+
+/** @internal */
+export interface DeprecatedOptions {
+ deprecated: string;
+ proposed?: string;
+ since?: string;
+ until?: string;
+}
+
+/** @internal */
+export function deprecated(opts: DeprecatedOptions): void {
+ let message = `[@faker-js/faker]: ${opts.deprecated} is deprecated`;
+
+ if (opts.since) {
+ message += ` since ${opts.since}`;
+ }
+
+ if (opts.until) {
+ message += ` and will be removed in ${opts.until}`;
+ }
+
+ if (opts.proposed) {
+ message += `. Please use ${opts.proposed} instead`;
+ }
+
+ console.warn(message + '.');
+}