Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Nutri-Score Calculator - The goal of the project is to provide simple library that can calculate the Nutri-Score.

NotificationsYou must be signed in to change notification settings

food-nutrients/nutri-score

Repository files navigation

Nutri Score logo

The goal of the project is to provide simple library that can calculate the Nutri-Score.

ReleaseGitHub code size in bytesCodacy BadgeDependenciesBuild Status

Demo / Example

What is the Nutri-Score ?

The Nutri-Score is a nutrition label that converts the nutritional value of products into a simple code consisting of 5 letters, each with its own colour.

Each product is awarded a score based on a scientific algorithm.

This formula takes into account the nutrients to avoid (energy value and the amount of sugars, saturated fats and salt) and the positive ones (the amount of fibre, protein, fruit, vegetables and nuts).

You can therefore see at a glance which products are recommended and which should be avoided.

Source:https://nutriscore.colruytgroup.com/colruytgroup/en/about-nutri-score/

Paper:https://pdfs.semanticscholar.org/3d1c/c206bc286bb5f80452821a0d26ff9e55b387.pdf

Nutri Score labels example

Usage

Import the library

<scriptsrc="https://cdn.jsdelivr.net/npm/nutri-score/nutriScore.js"></script>

or

yarn add nutri-score

or

npm install nutri-score --save

Calculate the nutri-score class:

import{nutriScore}from"nutri-score";constresult=nutriScore.calculateClass({energy:0,fibers:4,fruit_percentage:60,proteins:2,saturated_fats:2,sodium:500,sugar:10});console.log(result);// Output: "B"

For more methods & usage refer to the documentation bellow

Note: TypeScript definition are included in the project

Documentation

... Work in progress ...

Contribution

Feel free to add suggestions, PRs, comments and bug reports.

Authors

Alex Kolarski (aleks.rk@gmail.com)

License

(The MIT License)

Copyright (c) 2019

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

The above copyright notice and this permission notice shall beincluded 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 OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANYCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Nutri-Score Calculator - The goal of the project is to provide simple library that can calculate the Nutri-Score.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp