New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bcbp-vb

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bcbp-vb

Encoding/decoding library for the IATA Bar Coded Boarding Pass

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Build License Bundlephobia Version

BCBP

Encoding/decoding library for the IATA Bar Coded Boarding Pass

  • Supports version 6 of the BCBP standard
  • Supports any number of legs

Getting started

Installation

Installation is done using the npm install command:

$ npm install bcbp

Encode

encode(bcbp: BarcodedBoardingPass) => string

Example

import { encode } from "bcbp";

let output = encode({
  data: {
    legs: [
      {
        operatingCarrierPNR: "ABC123",
        departureAirport: "YUL",
        arrivalAirport: "FRA",
        operatingCarrierDesignator: "AC",
        flightNumber: "0834",
        flightDate: new Date("2020-08-13T00:00:00.000Z"),
        compartmentCode: "F",
        seatNumber: "001A",
        checkInSequenceNumber: "0025",
        passengerStatus: "1",
      },
    ],
    passengerName: "DESMARAIS/LUC",
  },
});

console.log(output);
// M1DESMARAIS/LUC       EABC123 YULFRAAC 0834 226F001A0025 106>60000

Decode

decode(bcbp: string, referenceYear?: number) => BarcodedBoardingPass

Example

import { decode } from "bcbp";

let output = decode(
  "M1DESMARAIS/LUC       EABC123 YULFRAAC 0834 226F001A0025 100"
);

console.log(output.data.passengerName);
// DESMARAIS/LUC

Reference Year

Define the year which is used when parsing date fields. If this is undefined, the current year is used.

import { decode } from "bcbp";

let output = decode(
  "M1DESMARAIS/LUC       EABC123 YULFRAAC 0834 226F001A0025 100",
  2010
);

console.log(output.data.legs[0].flightDate.toISOString());
// "2010-08-14T00:00:00.000Z"

BarcodedBoardingPass

See types.ts for the definition.

License

MIT

Keywords

FAQs

Package last updated on 18 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc