Git Product home page Git Product logo

dates-exercise's Introduction

Appointment Scheduler

This project provides utility functions to manage and calculate available appointment slots in a scheduling system.

Getting Started

These instructions will help you set up the project on your local machine for development and testing purposes.

Prerequisites

  • Node.js and npm installed on your machine. If not, you can download and install them from here.

Installation

  1. Clone the repository:

    git clone https://github.com/arizakevin/dates-exercices
  2. Navigate to the project directory:

    cd dates-exercices
  3. Install the required modules:

    npm install

Running the Code

To run the main code, use the following command:

npm start

Running the Tests

To run the unit tests, use the following command:

npm run test

Functions

  • timeToMinutes(time: string): Converts a time string to minutes since the start of the day.
  • availableSlotsForDay(appointments: Appointment[]): Calculates the available 30-minute slots for a given day based on the provided appointments.
  • totalAvailableSlots(weekAppointments: Appointment[][]): Calculates the total available 30-minute slots for a week based on the provided appointments.

Code Enhancements and Tooling

Prettier Code Formatting

The codebase integrates Prettier, a popular code formatter, ensuring consistent code style across the project. This helps maintain readability and reduces the chances of style-related issues.

Husky Pre-commit Hooks

With Husky, I've set up pre-commit hooks to ensure that every commit meets our quality standards. Before any commit is made, Husky checks for code formatting and runs tests to ensure everything is in order.

NPM Scripts

The project includes several npm scripts to streamline common tasks:

  • test: Runs unit tests using Jest.
  • start: Compiles the TypeScript code and then runs the main application.
  • format: Formats the entire codebase using Prettier.
  • prepare: Sets up Husky hooks.
  • check-types: Checks TypeScript types without emitting output.
  • check-format: Checks if the codebase is formatted correctly using Prettier.

To run any of these scripts, use the command npm run <script-name>. For example, to run tests, use npm run test.

dates-exercise's People

Contributors

arizakevinbt avatar

Watchers

Kevin Ariza 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.