Socket
Socket
Sign inDemoInstall

@harvest-profit/harvest-profit-calculations

Package Overview
Dependencies
1
Maintainers
4
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @harvest-profit/harvest-profit-calculations

All the calculations


Version published
Weekly downloads
92
decreased by-42.86%
Maintainers
4
Created
Weekly downloads
 

Readme

Source
Harvest Profit

Installation

You will need an NPM access token to access this repo.

Simply run the following to install:

yarn add @harvest-profit/harvest-profit-calculations

Usage

To use this package, just give it a try!

import { Contract } from '@harvest-profit/harvest-profit-calculations';

const contractUrl = Contract.translateContractTypeToUrl(Contract.hedgeToArriveType);
console.log(contractUrl); // Outputs: `hedge_to_arrive`

Additional Notes

This package is meant to standardize and document all the calculations used in the Harvest Profit App. The Calculations module is a good example of that. That module contains very simple functions like calculateAvgCashPrice which simply divides revenue by sold production, but each function documents on how to get that number which is important. If you are new to the project, that would be a good place to start reading some documentation.

As for standardizing, the Contract module is a good example of that. You should NEVER be checking what type the contract is, or setting the contract type without using the module defined types. Example:

// Example of BAD
if (contract.type_name === 'cashsale') {
   // ... do something
 }
// Example of GOOD
if (contract.type_name === Contract.cashSaleType) {
   // ... do something
 }

Or better yet...

// Example of GOOD
if (Contract.isCashSaleType(contract.type_name)) {
   // ... do something
 }

Development

Clone this repo, and begin committing changes. PRs are preferred over committing directly to master.

To run tests locally on your machine, run the following:

yarn run test

To preview documentation locally on your machine, run the following:

yarn run build-docs

After merging your pull request, consider updating the documentation with the following command:

yarn run publish-docs

Publishing

This package is published as a Private NPM Module.

To publish to the private NPM registry, simply run the following, after bumping the package.json version:

# Publish using Yarn
yarn publish

# Or publish using NPM
npm publish

License

Copyright 2017-Present Harvest Profit. This repo contains private code. No copying or external use permitted.

FAQs

Last updated on 04 Mar 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc