Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

bcbp

Package Overview
Dependencies
0
Maintainers
1
Versions
31
Issues
File Explorer

Advanced tools

bcbp

Encoding/decoding library for the IATA Bar Coded Boarding Pass

    6.0.0latest
    GitHub

Version published
Maintainers
1
Weekly downloads
769
increased by4.06%

Weekly downloads

Changelog

Source

v6.0.0

6.0.0 (2022-10-27)

Features

  • Update encode and decode function signatures to handle meta data (b203793)

BREAKING CHANGES

  • Please see README for new encode and decode function signatures

Readme

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 100

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

Last updated on 27 Oct 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc