forked from microsoft/TypeScript-DOM-lib-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstable.ts
More file actions
26 lines (25 loc) · 771 Bytes
/
Copy pathstable.ts
File metadata and controls
26 lines (25 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { SimpleSupportStatement } from "@mdn/browser-compat-data/types";
export function hasStableImplementation(
browser: SimpleSupportStatement | SimpleSupportStatement[] | undefined,
prefix?: string,
): boolean {
if (!browser) {
return false;
}
const latest = !Array.isArray(browser)
? browser
: browser.find((i) => i.prefix === prefix); // first one if no prefix
if (!latest) {
return false;
}
return (
!!latest.version_added &&
// "preview" means BCD has no idea about whether it will ride the train
// https://github.com/mdn/browser-compat-data/issues/12344
latest.version_added !== "preview" &&
!latest.version_removed &&
!latest.flags &&
latest.prefix === prefix &&
!latest.alternative_name
);
}