# jm-bigcommerce-price-helper

> jm-bigcommerce-price-helper

Latest version **0.2.6** (published 2020-07-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install jm-bigcommerce-price-helper
pnpm add jm-bigcommerce-price-helper
yarn add jm-bigcommerce-price-helper
bun add jm-bigcommerce-price-helper
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.6 |
| Published | 2020-07-01 |
| First published | 2020-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 28.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tuan Nguyen |
| Maintainers | tuanndjm |
| Keywords | jm-bigcommerce-price-helper |

## Links

- npm: https://www.npmjs.com/package/jm-bigcommerce-price-helper
- Repository: git@gitlab.jmango360.com:tuannd/jm-bigcommerce-price-helper
- npm.io page: https://npm.io/package/jm-bigcommerce-price-helper

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.2.6 (latest) — 2020-07-01
- 0.2.5 — 2020-04-19
- 0.2.4 — 2020-04-18
- 0.2.3 — 2020-04-17
- 0.2.2 — 2020-04-17
- 0.2.1 — 2020-01-10
- 0.2.0 — 2020-01-10
- 0.1.0 — 2020-01-07

## README

# price function

[NPM](https://www.npmjs.com/package/jm-bigcommerce-price-helper) |
[Git](https://gitlab.jmango360.com/tuannd/jm-bigcommerce-price-helper)

NOTES: showSaleTag in object return will only use for custom app because have sale tag show with price range

# Installation

```shell
$ npm i jm-bigcommerce-price-helper
```

================

# Expand type view

```js
// Display type as string
RANGE | BASE | SALE | RETAIL_BASE | RETAIL_SALE | BASE_SALE | ALL;
```

# RANGE

- How to show

  > $minPriceValue - $maxPriceValue

- Example
  > $0 - $10

# BASE ~ SALE

- How to show

  > $basePriceValue<br>
  > or<br>
  > $salePriceValue<br>

- Example
  > \$10

# RETAIL_BASE ~ RETAIL_SALE

- How to show:

  > MSRP: <s>$retailPriceValue</s> <br>
  > $basePriceValue<br>
  > or<br>
  > MSRP: <s>$retailPriceValue</s> <br>
  > $salePriceValue

- Example:

  > MSRP: <s>$100</s> <br>
  > $10

## BASE_SALE

- How to show:
  > WAS: <s>$basePriceValue</s> <br>
  > NOW: $salePriceValue
- Example:
  > WAS: <s>$100</s> <br>
  > NOW: $10

## ALL

- How to show:
  > MSRP: <s>$retailPriceValue</s> <br>
  > WAS: <s>$basePriceValue</s> <br>
  > NOW: \$salePriceValue
- Example:
  > MSRP: <s>$100</s> <br>
  > WAS: <s>$100</s> <br>
  > NOW: \$10

================

# Using in product list

```js
import { processPriceForList } from 'jm-bigcommerce-price-helper';

const priceObj = processPriceForList((productData: any = {}));
```

## Require params

```js
productData = {
  id: number,
  price: number,
  salePrice: number,
  retailPrice: number,
  calculatedPrice: number,
  inventoryTracking: string,
  variants: any[],
  ...
};
```

## Return object

```js
finalObj = {
  type: string,
  productId: number,
  minPriceValue: number,
  maxPriceValue: number,
  showSaleTag: number,
  priceValue: number,
  salePriceValue: number,
  retailPriceValue: number,
};
```

================

# Using in product detail

```js
import { processPriceForDetail } from 'jm-bigcommerce-price-helper';

const priceObj = processPriceForDetail(((productDetail: any = {}), (listSelectedOption: any[]), (pricingRules: any[])));
```

## Require params

```js
// id: id of option
// idOptionSelect: id of selected value of option
// type: type of option
// valueSelected: value for checkbox value, because value true or false will different.
data = {
  productDetail: any,
  listSelectedOption: any[{id: number; idOptionSelect: number; type: string, valueSelected: boolean}],
  pricingRules: any[],
  ...
};
```

## Return object

```js
finalObj = {
  type: string,
  productId: number,
  minPriceValue: number,
  maxPriceValue: number,
  showSaleTag: number,
  priceValue: number,
  salePriceValue: number,
  retailPriceValue: number,
};
```

---
_Source: https://npm.io/package/jm-bigcommerce-price-helper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
