IF Commons GitHub

logical/detect

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-estate-endpoints-readers FR-008

Which reader reads a text: by what is in it. A JSON or YAML with openapi or swagger is OpenAPI; a text with type Query or schema {, or a JSON with __schema, is GraphQL; an XML with <manifest is an Android manifest and one with <plist an iOS property list; a PEM with a certificate is a certificate; a text with ss -tuln lines or osquery's rows is listening ports; a text with $ORIGIN or an SOA record is a zone. A certificate is read by the physical layer, which has the cryptography.

import { detectFormat } from "./detect.ts";
detectFormat("a.xml", '<manifest package="a.b"/>'); // "android"

Source: commons/estate-endpoints/src/logical/detect.ts

2 of 6 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

logical.ReadOptionstypeno test imports it
type ReadOptions = { readonly url?: string; readonly host?: string; readonly asset?: string; readonly origin?: string };

The facts a reader may need that a text does not say.

logical.detectFormatfunctionno test imports it
function detectFormat(_source: string, text: string): "android" | "certificate" | "dns-zone" | "graphql" | "ios" | "listening-ports" | "openapi" | undefined

The format of a text, or nothing where none is read.

logical.readTextfunctionno test imports it
function readText(source: string, text: string, options?: ReadOptions): Found

The assets and links of a text by its format, or a problem where none is read. A certificate is not read here.

ReadOptionstypeno test imports it
type ReadOptions = { readonly url?: string; readonly host?: string; readonly asset?: string; readonly origin?: string };

The facts a reader may need that a text does not say.

detectFormatfunction
function detectFormat(_source: string, text: string): "android" | "certificate" | "dns-zone" | "graphql" | "ios" | "listening-ports" | "openapi" | undefined

The format of a text, or nothing where none is read.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

readTextfunction
function readText(source: string, text: string, options?: ReadOptions): Found

The assets and links of a text by its format, or a problem where none is read. A certificate is not read here.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.