Skip to content

About

Calculate weighted averages from the command line.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weighted-avg-cli

npm version license

Compute weighted averages from the command line. Zero dependencies.

Install

npm i -g @kszongic/weighted-avg-cli

Usage

# From arguments (value:weight pairs)
weighted-avg 90:3 80:2 70:1
# => 83.33333333333333

# With precision
weighted-avg -p 2 90:3 80:2 70:1
# => 83.33

# Custom delimiter
weighted-avg -d , 90,3 80,2 70,1
# => 83.33333333333333

# From stdin
echo -e "90:3\n80:2\n70:1" | weighted-avg
# => 83.33333333333333

# Pipe from a file
cat grades.txt | weighted-avg -p 1

Use Cases

  • GPA calculation: weighted-avg 4.0:3 3.7:4 3.3:3
  • Portfolio returns: weighted-avg 0.12:50000 0.08:30000 -0.02:20000
  • Sensor fusion: combine readings with confidence weights

Options

Flag Description
-p, --precision <n> Decimal places (default: auto)
-d, --delimiter <d> Value/weight separator (default: :)
-h, --help Show help
-v, --version Show version

License

MIT © 2026 kszongic

About

Calculate weighted averages from the command line.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages