npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

openrest4js

v1.0.946

Published

The Openrest SDK for JavaScript

Downloads

1,020

Readme

#openrest4js

NPM version Downloads

OpenRest (founded early 2011) is a cloud-based service that enables restaurant owners to easily create online ordering websites, mobile websites and native mobile apps. As of September 2014, a total of almost a thousand restaurants power their online ordering systems with OpenRest.

OpenRest offers an open API for developers. The OpenRest API is exposed as a standard web service communicating JSON over HTTPS.

OpenRest was acquired by Wix.com in later 2014, and can now be found as Wix Restaurants.

This package contains three different modules:

Client

To use the client, it is perfered to use the derived openrest4node

Fixture

Fixtures let you create openrest objects using functions. Example:

import {fixtures} from 'openrest4js';

const charge = fixtures.ChargeV2().
    deliveryTypes(['delivery']).
    displayConditionDeliveryTypes(['delivery', 'pickup']).
    platforms(['mobileweb', 'web']).
    val();

List of available fixtures:

ChargeV2

Creates a ChargeV2 object

  • fixtures.ChargeV2.title(val) - Updates the title of the charge. Assumes 'en_US' locale.
  • fixtures.ChargeV2.description(val) - Updates the description of the charge. Assumes 'en_US' locale.
  • fixtures.ChargeV2.percentageDiscount({percentage, itemIds}) - Sets the charge as a percentage discount. percentage is times 100 (eg, 1234 means 12.34%). itemIds is a list of itemIds to calculate the percentage on.
  • fixtures.ChargeV2.tax({percentage, itemIds}) - Sets the charge as a tax charge. percentage is times 100 (eg, 1234 means 12.34%). itemIds is a list of itemIds to calculate the percentage on.
  • fixtures.ChargeV2.fixedDiscount({price}) - Sets the charge as a fixed discount. price is times 100 (eg, 1234 means $12.34).
  • fixtures.ChargeV2.deliveryTypes(types) - Sets the list of delivery types in the charge's condition.
  • fixtures.ChargeV2.displayConditionDeliveryTypes(types) - Sets the list of delivery types in the charge's display condition.
  • fixtures.ChargeV2.platforms(platforms) - Sets the list of platforms in the charge's condition.
  • fixtures.ChargeV2.displayConditionPlatforms(platforms) - Sets the list of platforms in the charge's display condition.
  • fixtures.ChargeV2.min(min) - Sets the minimum price in the charge's condition.
  • fixtures.ChargeV2.displayConditionMin(min) - Sets the minimum price in the charge's display condition.
  • fixtures.ChargeV2.deliveryTime(availability) - Sets the weekly availability in the charge's condition.
  • fixtures.ChargeV2.displayConditionDeliveryTime(availability) - Sets the weekly availability in the charge's display condition.
  • fixtures.ChargeV2.close() - Sets the state of the charge to 'closed'.
  • fixtures.ChargeV2.val() - Returns the final charge created.

Availability

Creates an Availability object

  • fixtures.Avalability.addWeeklyFromDate({start, end}) - Adds duration to the availability.weekly field, translating the start and end to minutes of week (mainly used for testing).

Helpers

ChargeV2

Helper functions to work with ChargeV2 objects.

  • isApplicable({charge, deliveryTime, deliveryType, orderItems, source, platform}) - Checks if a charge is applicable to the current parameters.
  • isDisplayable({charge, deliveryTime, deliveryType, orderItems, source, platform}) - Checks if a charge is displayable to the current parameters.
  • calculateAmount({charge, orderItems, orderCharges, extraCost}) - Calculates the amount the matching OrderCharge should contain.

OrderItem

Helper functions to work with OrderItems objects.

  • getTotalPrice({orderItem}) - Calculates the total price of an OrderItem (including variations).

Order

Helper functions to work with Order objects.

  • getOrderCharges({order, chargesV2}) - Returns the orderCharges calculated, that should be added to the order object. Receives an existing order object that should contain order.deilvery.type, order.delivery.time, and order.orderItems to calculate correctly. chargeV2 should be from the menu.

Image

Helper functions to work with image URLs.

  • fill({url, width, height}) - Returns a URL that serves the resized image. Passing 0 for width or height means maximum size.