# local-price

> Show local prices based on the country.

Latest version **1.0.2** (published 2017-05-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install local-price
pnpm add local-price
yarn add local-price
bun add local-price
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-05-29 |
| First published | 2017-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ion Suman |
| Maintainers | sumanion |

## Links

- npm: https://www.npmjs.com/package/local-price
- Repository: https://github.com/103058/local-price
- Homepage: https://github.com/103058/local-price#readme
- Issues: https://github.com/103058/local-price/issues
- npm.io page: https://npm.io/package/local-price

## Dependencies (1)

- [convert-price](https://npm.io/package/convert-price.md) ^1.0.0

## Recent versions

- 1.0.2 (latest) — 2017-05-29
- 1.0.1 — 2017-05-14
- 1.0.0 — 2017-05-14

## README

# Local Price

Show local prices based on the country.

## Installation

Using npm:

```bash
$ npm install local-price --save
```

Using yarn:

```bash
$ yarn add local-price
```

## Usage

In [ExpressJS](http://expressjs.com/):

```js
// Load the module.
const localPrice = require('local-price')

// The Express app.
const app = express()

// There are some values the `local-price` module will look for.
app.use((req, res, next) => {
  // Current country of the client.
  // Note: Defaults to 'US'.
  res.locals.country = 'FR'

  // Base currency of the application.
  // Note: Defaults to 'USD'.
  res.locals.currency = 'USD'

  next()
})

// Load the middleware.
app.use(localPrice())

// Next, you should be able to access module's functionality.
app.get('/', (req, res) => {
  let { localPrice, localCurrency } = res.locals

  // Convert 10 USD (base currency) to EUR (primary currency in France).
  localPrice(10)
    .then(convertedValue => {
      //
    })
    .catch(err => {
      //
    })

  // Get the local currency.
  localCurrency // 'EUR'
})
```

## License

The MIT License (MIT)

Copyright (c) 2017 Ion Suman <sumanion122@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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