1.2.0 • Published 1 year ago

@tictuk/item-availability v1.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Item Availability Package

It's a simple package that implements availability checking.

Usage

import { isAvailableNow, isAvailable } from '@tictuk/item-availability';

const availability = {
  weekly: [],
  exceptions: [],
};

console.log(isAvailableNow(availability)); // true
console.log(isAvailable(availability, new Date(2022, 4, 1))); // true

You can also pass Item objects directly

import {
  isItemAvailable,
  isItemAvailableNow,
  Item,
} from '@tictuk/item-availability';

const item: Item = {
  condition: {
    conditions: [
      {},
      {},
      {},
      {
        weekly: [],
        exceptions: [],
      },
    ],
  },
};

console.log(isItemAvailableNow(item)); // true
console.log(isItemAvailable(item, new Date(Date.now()))); // The date has to be UTC timezone
1.2.0

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago