Skip to content

Commit

Permalink
chore(api): remove obsolete assert()
Browse files Browse the repository at this point in the history
BREAKING CHANGE: assert() moved to thi.ng/errors pkg

- see 7030a6a for details
  • Loading branch information
postspectacular committed Sep 20, 2021
1 parent 7030a6a commit 5f6ec5c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 36 deletions.
3 changes: 0 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,6 @@
"./api/watch": {
"import": "./api/watch.js"
},
"./assert": {
"import": "./assert.js"
},
"./constants": {
"import": "./constants.js"
},
Expand Down
29 changes: 0 additions & 29 deletions packages/api/src/assert.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/api/src/decorators/deprecated.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { assert } from "../assert";

/**
* Method property decorator factory. Augments original method with
* deprecation message (via console), shown when method is invoked.
Expand All @@ -16,7 +14,9 @@ export const deprecated = (msg?: string, log = console.log): MethodDecorator =>
) {
const signature = `${target.constructor.name}#${prop.toString()}`;
const fn = descriptor.value;
assert(typeof fn === "function", `${signature} is not a function`);
if (typeof fn !== "function") {
throw new Error(`${signature} is not a function`);
}
descriptor.value = function () {
log(`DEPRECATED ${signature}: ${msg || "will be removed soon"}`);
return fn.apply(this, arguments);
Expand Down
1 change: 0 additions & 1 deletion packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export * from "./api/tuple";
export * from "./api/typedarray";
export * from "./api/watch";

export * from "./assert";
export * from "./constants";
export * from "./expose";
export * from "./logger";
Expand Down

0 comments on commit 5f6ec5c

Please sign in to comment.