benhovinga / caf-ranks

Complete list of the Canadian Armed Forces rank structure in JSON format (bilingual)
https://www.npmjs.com/package/caf-ranks
Other
0 stars 0 forks source link
canadian-armed-forces dataset military rank-structure

Canadian Armed Forces (CAF) Ranks

Current Version: v0.6.0

Ranks in the Canadian Armed Forces mark a person's position in its hierarchical structure. As people gain more responsibility and authority, they earn promotions in rank.

This library enables the easy reusability of the Canadian Armed Forces Ranks within your own project.

Features

Install

This library is available using the Node Package Manager.

npm install caf-ranks

Import Into Your Project

Depending on the environment you are using, importing the library will look a little different.

// CommonJS
const { allRanks } = require("caf-ranks");

// ModernJS
import { allRanks } from "caf-ranks";

Examples

Basic Usage

import { allRanks } from "caf-ranks";

// Log all English ranks to the console
allRanks.forEach((rank) => {
  console.log(rank.title.en);
});
/*
  General
  Admiral
  Lieutenant-General
  Vice-Admiral
  Major-General
  (...)
*/

// Log all French rank abberviations to the console
allRanks.forEach((rank) => {
  console.log(rank.abbreviation.fr);
});
/*
  gén
  am
  lgén
  vam
  mgén
  (...)
*/

Filtering Ranks

import {
  allRanks,
  filterRanksByCommand,
  filterRanksByCategory,
} from "caf-ranks";

// Log all English Navy ranks to the console
const navyRanks = filterRanksByCommand(allRanks, "RCN");
navyRanks.forEach((rank) => {
  console.log(rank.title.en);
});
/*
  Admiral
  Vice-Admiral
  Rear-Admiral
  Commodore
  Captain(N)
  (...)
*/

// Log all French Air Force NCM ranks to the console
const airForceRanks = filterRanksByCommand(allRanks, "RCAF");
const airForceNCMRanks = filterRanksByCategory(airForceRanks, "JuniorNCM");
airForceNCMRanks.forEach((rank) => {
  console.log(rank.title.fr);
});
/*
  Caporal-chef
  Caporal
  Aviateur (formé)
  Aviateur (confirmé)
*/

Using Rank Meta

import { rankMeta } from "caf-ranks";

// Log the English version of the Army element to the console
console.log(rankMeta.command.CA.en);
/*
  Canadian Army
*/

// Log the French version of the Flag Officer category to the console
console.log(rankMeta.category.FlagOfficer.fr);
/*
  Officiers généraux
*/

License

This project is licensed under the Open Government Licence - Canada 2.0

See LICENSE.md

Sources