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

@harvest-profit/harvest-profit-calculations

v1.2.3

Published

All the calculations

Downloads

249

Readme

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.