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

@windingtree/wt-pricing-algorithms

Package Overview
Dependencies
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@windingtree/wt-pricing-algorithms

Javascript libraries to compute prices from Winding Tree data model

  • 0.6.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

Winding Tree Pricing algorithms

Greenkeeper badge

Javascript implementation of pricing algorithms based on data stored in Winding Tree platform.

Installation and usage

npm install @windingtree/wt-pricing-algorithms
import {
  prices, availability, cancellationFees
} from '@windingtree/wt-pricing-algorithms';
<script type="text/javascript" src="https://unpkg.com/@windingtree/wt-pricing-algorithms"></script>
<script type="text/javascript">
// Price
const pc = new window.wtPricingAlgorithms.prices.PriceComputer(
  hotelDataFromApi.roomTypes,
  hotelDataFromApi.ratePlans,
  hotelDataFromApi.currency
);
// You can use different pricing strategies, see the generated documentation for that
resultingPrice = pc.getBestPrice(
  new Date(), // Booking date
  arrival,
  departure,
  guests,
  hotelDataFromApi.currency,
  roomType
);

// Availability
const indexedAvailability = window.wtPricingAlgorithms.availability.indexAvailability(
  hotelDataFromApi.availability.roomTypes
 );
const roomAvailability = window.wtPricingAlgorithms.availability.computeAvailability(
  arrival,
  departure,
  guests.length,
  hotelDataFromApi.roomTypes,
  indexedAvailability
);

// Cancellation fees
const cancellationFees = window.wtPricingAlgorithms.cancellationFees.computeCancellationFees(
  new Date(),
  dayjs(arrivalDateInput.value),
  hotelDataFromApi.cancellationPolicies,
  hotelDataFromApi.defaultCancellationAmount
);
</script>

Development

git clone https://github.com/windingtree/wt-pricing-algorithms
nvm install
npm install
npm test

Keywords

FAQs

Package last updated on 31 May 2019

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