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

beaufort-scale

v1.1.2

Published

Translate speed to Beaufort wind force scale in both Node and the Browser

Downloads

35

Readme

beaufort-scale npm

Translate speed to Beaufort wind force scale in both Node and the Browser. Returns the Beaufort Scale intensity grade number from a given wind speed (in Kilometres per hour).

Install and Include the module

  • Node

    $ npm install beaufort-scale
    var beaufort = require('beaufort-scale')
  • or Browser

    Clone the repo or download the minified file : beaufort-scale.min.js

    $ git clone https://github.com/alterebro/beaufort-scale.git
    <script src="/your/path/to//beaufort-scale/dist/beaufort-scale.min.js"></script>

Usage

beaufort(40)

// returns an object
{
	grade: 6.09,
	desc: "Strong breeze"
}

Options

There are two options that can be sent to the beaufort function. These are optional and have to be passed as an Object.

  • lang : String or Array the language of the description string ( desc ). As a string there are two possible values, en for English or es for Spanish, the default value is en.
    As an array you can add your own language string values
  • int : Boolean determines if the grade returns an integer or a floating number, default value is false.

Example

beaufort(40, {lang: 'es', int: true})

// returns the following object
{
	grade: 6,
	desc: "Brisa fuerte"
}

With an array of values as a lang parameter, for example with the greek strings as provided by @groubis

beaufort(1, { lang: ["Άπνοια", "Σχεδόν άπνοια", "Πολύ ασθενής", "Ασθενής", "Σχεδόν μέτριος", "Μέτριος", "Ισχυρός", "Σχεδόν θυελλώδης", "Θυελλώδης", "Πολύ θυελλώδης", "Θύελλα", "Σφοδρή θύελλα", "Τυφώνας"], int : true });

// returns the object:
{
	grade: 0,
	desc: "Άπνοια"
}

Build

$ npm run build
# or alternatively just:
$ gulp

Tests

$ npm test
$ npm run cov 	# with test coverage