@radsoft/markbase 2026.8.3 → 2026.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -199,6 +199,7 @@ USPTO records are raw. These make them presentable:
199
199
  import { statusOf, parseDate, padClass } from "@radsoft/markbase";
200
200
 
201
201
  statusOf("800"); // "registered"
202
+ statusOf("630"); // "pending" — a new application, not a dead one
202
203
  statusOf("601"); // "dead"
203
204
  statusOf("710"); // "cancelled"
204
205
  parseDate("19720131"); // Date(1972-01-31) — the register stores YYYYMMDD
package/dist/client.js CHANGED
@@ -4,24 +4,30 @@ export function padClass(v) {
4
4
  const s = String(v);
5
5
  return /^\d+$/.test(s) ? s.padStart(3, "0") : s;
6
6
  }
7
+ // uspto status codes don't fall into tidy ranges — 630 is a brand new
8
+ // application and 602 an abandoned one. groups follow uspto.report's live/dead
9
+ // table, plus 610 (terminated after sanctions) and 781-783 (newer cancellations)
10
+ // checked against tsdr. anything not listed is unknown rather than a guess.
11
+ const STATUS_GROUPS = {
12
+ pending: "410 413 616 620 630 631 638 640-661 663-668 672 680-682 686 688-690 692-694 " +
13
+ "718-722 724 725 730-734 740 744-746 748 752 753 756 757 760 762-766 771-775 " +
14
+ "777 779 794 801-804 806-825 969 973",
15
+ registered: "624 625 700-708 717 739 778 780 790 800",
16
+ dead: "402 411 412 416 600-610 612 614 618 632 901",
17
+ cancelled: "400 401 403-406 414 415 417 626 709-715 781-783",
18
+ expired: "900",
19
+ };
20
+ const STATUS_BY_CODE = new Map();
21
+ for (const [status, list] of Object.entries(STATUS_GROUPS)) {
22
+ for (const part of list.split(" ")) {
23
+ const [from, to = from] = part.split("-").map(Number);
24
+ for (let n = from; n <= to; n++)
25
+ STATUS_BY_CODE.set(n, status);
26
+ }
27
+ }
7
28
  /** Turn a numeric USPTO status code into something you can show a user. */
8
29
  export function statusOf(code) {
9
- if (!code)
10
- return "unknown";
11
- const n = parseInt(code, 10);
12
- if (Number.isNaN(n))
13
- return "unknown";
14
- if (n >= 600 && n < 700)
15
- return "dead";
16
- if (n >= 710 && n < 720)
17
- return "cancelled";
18
- if (n >= 900)
19
- return "expired";
20
- if (n >= 800 || n === 700 || (n >= 730 && n < 740))
21
- return "registered";
22
- if (n < 600)
23
- return "pending";
24
- return "registered";
30
+ return STATUS_BY_CODE.get(parseInt(code ?? "", 10)) ?? "unknown";
25
31
  }
26
32
  /** USPTO dates are YYYYMMDD strings; this gives you a Date or null. */
27
33
  export function parseDate(d) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radsoft/markbase",
3
- "version": "2026.8.3",
3
+ "version": "2026.10.1",
4
4
  "description": "Official Node client for the Markbase USPTO trademark API — search, screen, and look up 14M+ US trademarks.",
5
5
  "license": "MIT",
6
6
  "type": "module",