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

@maximva/examenopdracht-maximva

v1.0.0

Published

examn assignment for software engineering

Downloads

16

Readme

7-Segment temperature display

npm badge ESLint Markdown Linter Tests

About this npm package

This package makes it possible for anybody to transform a simple temperature to an 7-segment representation of it (in string format) to print to a webpage or to the console, or anywhere for that matter. For example, given a temperature of 5.1 the result would be this:

 ______________________
|   _           _  _   |
|  |_      |   |_||    |
|   _| /   |      |_   |
|______________________|

This is the assignment for my 4th semester exam 'Software Engineering'.

How to install the package

It's available as an package on npmjs.com.

You can only use packages if your project itself is a 'package', if that's not yet the case, do this:

npm init

Just run through the question and at the end it will create your package.json file. Then you just install this package like so:

npm install @maximva/examenopdracht-maximva

The example code below expects you to have typescript (npm install typescript) installed.

Documentation

All documentation can be found here (GitHub Pages).

Some code examples with output

Regular size with frame

import { Display } from '@maximva/examenopdracht-maximva'
import { Temperature } from '@maximva/examenopdracht-maximva'
import { DisplaySize } from '@maximva/examenopdracht-maximva'

const displaySettings = {
    frame : true,
    size : DisplaySize.regular
}

const temperature: Temperature = new Temperature(12.81)
const display: Display = new Display(displaySettings)
const displayOutput = display.write(temperature.toString())

console.log(displayOutput)
 _______________________________
|         _     _        _  _   |
|   _   | _|   |_|  |   |_||    |
|       ||_  / |_|  |      |_   |
|_______________________________|

Now with some different settings

const displaySettings = {
    frame : false,
    size : DisplaySize.regular
}
       _     _        _  _
 _   | _|   |_|  |   |_||
     ||_  / |_|  |      |_
const displaySettings = {
    frame : false,
    size : DisplaySize.large
}
           ___       ___            ___  ___
         |    |     |   |    |     |   ||
         |    |     |   |    |     |   ||
 ___       ___       ___            ___
         ||         |   |    |          |
         ||         |   |    |          |
           ___   /   ___                 ___
const displaySettings = {
    frame : true,
    size : DisplaySize.large
}
 _________________________________________________
|             ___       ___            ___  ___   |
|           |    |     |   |    |     |   ||      |
|           |    |     |   |    |     |   ||      |
|   ___       ___       ___            ___        |
|           ||         |   |    |          |      |
|           ||         |   |    |          |      |
|             ___   /   ___                 ___   |
|_________________________________________________|

Sources

In the digits class each supported character is represented by a series of binary values. I had some problems using a string (with the character in question) as a key and ended up implementing this solution

License

Have a look here for more information about the license: The Unlicense

About the creator

The creator of this package is me, Maxim Vanden Abeele. I'm a student at University College Vives in Bruges. You can find me on LinkedIn.