Giter Site home page Giter Site logo

node-flight-designator's Introduction

Flight Designator

npm npm license npm downloads build status

Install via npm

$ npm install --save flight-designator

Usage

For API Documentation, see doc/api-reference.md

var FlightDesignator = require( 'flight-designator' )
Parse
FlightDesignator.parse( 'U24511A' ) // OR
new FlightDesignator().parse( 'U24511A' )
> FlightDesignator {
  airlineCode: 'U2',
  flightNumber: 4511,
  operationalSuffix: 'A'
}
Validate
FlightDesignator.isValid( 'KLM0180' )
> true
FlightDesignator.isValidAirlineCode( 'KLM' )
> true
FlightDesignator.isValidFlightNumber( '0180' )
> true
Construct & validate instance
// Construct a flight designator
var flight = new FlightDesignator( 'KLM', '645' )
> FlightDesignator {
  airlineCode: 'KLM',
  flightNumber: 645,
  operationalSuffix: ''
}
// Check whether it's valid
flight.isValid()
> true
Format flight designators
FlightDesignator.format( 'u2 0350A' )
// Compact
> 'U2350A'
// With spaces
FlightDesignator.format( 'u2 0350A', true )
> 'U2 350 A'
// With zero-padded flight number
FlightDesignator.format( 'u2350A', true, true )
> 'U2 0350 A'
var flight = new FlightDesignator( 'LH', 254, 'X' )
// Compact
flight.toString()
> 'LH254X'
// With spaces
flight.toString( true )
> 'LH 254 X'
// With zero-padded flight number
flight.toString( true, true )
> 'LH 0254 X'

node-flight-designator's People

Contributors

jhermsmeier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.