Skip to content

API reference / @zaes/sidc

@zaes/sidc ​

@zaes/sidc — symbol identification codes of MIL-STD-2525C, 2525D and 2525E (and APP-6 D/E): read, validate and write them. No dependencies, no DOM, no drawing.

Interfaces ​

Type Aliases ​

AmplifierKind ​

ts
type AmplifierKind = "none" | "echelon" | "mobility" | "towedArray" | "leadership";

NumericSidcFields ​

ts
type NumericSidcFields = Partial<Omit<NumericSidc, 
  | "kind"
  | "code"
  | "standard"
  | "standardIdentityGroup"
  | "headquarters"
  | "taskForce"
| "feintDummy">>;

The fields a numeric SIDC is written from; anything left out is 0.


NumericStandard ​

ts
type NumericStandard = "2525D" | "2525E" | "APP-6D" | "APP-6E";

The standard a numeric SIDC's version (positions 1–2) belongs to.


ParseResult ​

ts
type ParseResult<T> = 
  | {
  ok: true;
  problems: readonly Problem[];
  sidc: T;
}
  | {
  ok: false;
  problems: readonly Problem[];
};

Type Parameters ​

T ​

T


Sidc ​

ts
type Sidc = 
  | NumericSidc
  | LetterSidc;

StandardIdentityGroup ​

ts
type StandardIdentityGroup = "Unknown" | "Friend" | "Neutral" | "Hostile";

The four frame families of Table A-III.

Variables ​

AMPLIFYING_DESCRIPTORS ​

ts
const AMPLIFYING_DESCRIPTORS: readonly AmplifierEntry[];

Table A-VIII, Amplifying descriptor (positions 9–10): echelon, mobility, towed array or leadership.


BATTLE_DIMENSIONS ​

ts
const BATTLE_DIMENSIONS: readonly CodeEntry[];

2525C Table A-I, position 3, for the warfighting scheme.


CODING_SCHEMES ​

ts
const CODING_SCHEMES: readonly (CodeEntry & object)[];

2525C Table A-I, position 1, with the appendix each scheme is defined in.


CONTEXTS ​

ts
const CONTEXTS: readonly CodeEntry[];

Table A-II, first position: the context.


FRAME_SHAPES ​

ts
const FRAME_SHAPES: readonly CodeEntry[];

Table A-LX, Frame shape (position 23): overrides the frame the symbol set would draw.


GENC_COUNTRIES ​

ts
const GENC_COUNTRIES: readonly (readonly [string, string, string, string])[];

[numeric, trigraph, digraph ('' where none is assigned), name]. 280 entries.


GRAPHIC_ORDERS_OF_BATTLE ​

ts
const GRAPHIC_ORDERS_OF_BATTLE: readonly CodeEntry[];

2525C Table B-I, position 15 of a tactical graphic (coding scheme G).


HQ_TF_DUMMY ​

ts
const HQ_TF_DUMMY: readonly CodeEntry[];

Table A-VII, Headquarters/task force/dummy: three flags, one digit.


LETTER_IDENTITIES ​

ts
const LETTER_IDENTITIES: readonly (CodeEntry & object)[];

2525C Table A-I, position 2, with whether it is the exercise form and its frame family.


LETTER_STATUSES ​

ts
const LETTER_STATUSES: readonly CodeEntry[];

2525C Table A-I, position 4.


ORDERS_OF_BATTLE ​

ts
const ORDERS_OF_BATTLE: readonly CodeEntry[];

2525C Table A-I, position 15.


STANDARD_IDENTITIES ​

ts
const STANDARD_IDENTITIES: readonly StandardIdentityEntry[];

Table A-II, second position: the standard identity, with its Table A-III group.


STATUSES ​

ts
const STATUSES: readonly CodeEntry[];

Table A-VI, Status. The same position may carry an operational condition instead (A.5.3.4.1).


SYMBOL_SETS ​

ts
const SYMBOL_SETS: readonly CodeEntry[];

Table A-IV, Symbol sets (2525E). 2525D's 51–54 are not here: E folded them into 50.


SYMBOL_SETS_2525D_ONLY ​

ts
const SYMBOL_SETS_2525D_ONLY: readonly CodeEntry[];

2525D's signals-intelligence sets (2525D Table A-IV), accepted as 2525D input only.


VERSIONS ​

ts
const VERSIONS: readonly VersionEntry[];

Table A-I, Version. Value 10 is shared by 2525D and APP-6(D)(1), which the standard says carry the same versioning; standard gives the US one. 12, APP-6(D)(2), was withdrawn but codes carrying it may still exist. 17–3F are reserved.

Functions ​

formatNumericSidc() ​

ts
function formatNumericSidc(fields): string;

Writes a 30-position 2525E SIDC (version 15 unless given). Each field is padded to its width.

Parameters ​

fields ​

NumericSidcFields

Returns ​

string


gencCountry() ​

ts
function gencCountry(numeric): 
  | {
  digraph: string;
  name: string;
  trigraph: string;
}
  | undefined;

The country a three-digit GENC numeric code names, or undefined for '000' and unknown codes.

Parameters ​

numeric ​

string

Returns ​

| { digraph: string; name: string; trigraph: string; } | undefined


lookup() ​

ts
function lookup<E>(table, value): E | undefined;

Looks a value up in one of the tables above.

Type Parameters ​

E ​

E extends CodeEntry<string>

Parameters ​

table ​

readonly E[]

value ​

string

Returns ​

E | undefined


parseLetterSidc() ​

ts
function parseLetterSidc(input): ParseResult<LetterSidc>;

Reads a 2525C letter SIDC. Values the tables don't define are listed in problems. A code given without its trailing unused positions (SFGPUCI for SFGPUCI--------, as some systems store them) is read with dashes filling them, and problems says so; at least scheme, identity, dimension and status (4 characters) are needed.

Parameters ​

input ​

string

Returns ​

ParseResult<LetterSidc>


parseNumericSidc() ​

ts
function parseNumericSidc(input): ParseResult<NumericSidc>;

Reads a numeric SIDC. A code of the wrong length or with characters outside [0-9A-F] fails; a well-formed code with values the tables don't define parses, with each one listed in problems, so a caller can decide whether to draw it.

Parameters ​

input ​

string

Returns ​

ParseResult<NumericSidc>


parseSidc() ​

ts
function parseSidc(input): ParseResult<Sidc>;

Reads any SIDC: starting with a letter is 2525C (15 characters); 20 or 30 digits is numeric.

Parameters ​

input ​

string

Returns ​

ParseResult<Sidc>

Released under the MIT License; the drawings derive from Apache-2.0 work.