Giter VIP home page Giter VIP logo

cocovoit's Introduction

Simple carpooling library

This is a simple library to manage carpooling, built with node and some โ™ฅ.

Resources

Working with the library

This library is a simple project to build something (re)usable with tests.

const Coco = require("cocovoit");
const Carpooling = new Coco();

// Build options for a journey
const options = {
  kms: 35.5,
  price_per_kms: 1.62,
  passengers: [],
  comeBack: true,
  conductor: "ugo",
  car: {
    model: "308",
    brand: "Peugeot",
    consumption: 7
  }
};

// Create a journey
const journey = Carpooling.createJourney(options);

// Create a passenger
const uPassenger = Carpooling.createPassenger({ name: "ugo", age: 28 }, { number_per_week: 5, comeBack: true });

// Add a passenger
journey.addPassengers(uPassenger)
const passengersList = journey.passengersList;

// Get the passengers of a journey
const numberOfPassengers = journey.passengersList;

// Get the price per passenger for a journey
const pricePerPassenger = journey.calculate();

console.log("All the Journey details", journey);

See in the examples/ folder to see more ways on how to play with the library.

Working on the library

git clone [email protected]:Ugarz/cocovoit.git
cd cocovoit
npm start          // Run the example code
npm run dev        // Run a live server to play around (you can edit examples/example-1.js in live mode)
npm test           // Run the tests
npm run test:live  // Run the tests, live
npm run doc        // Generate the documentation in `out/` folder
npm serve          // Serve the documentation in http://localhost:5000

Cocovoit - Les Lopez

cocovoit's People

Contributors

ugarz avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.