Giter Site home page Giter Site logo

Does not convert 'F' unit about everything-metric HOT 5 OPEN

haarp avatar haarp commented on July 18, 2024 2
Does not convert 'F' unit

from everything-metric.

Comments (5)

getsnoopy avatar getsnoopy commented on July 18, 2024 3

100F, ignoring the lack of a space between the quantity and the unit symbol, means "100 Farads", a unit of electrical capacitance.

from everything-metric.

MaZZly avatar MaZZly commented on July 18, 2024

@getsnoopy could this be added as an option (pretty please), although it not being "scientifically correct".

Similar to #14 usually people on reddit, and some recipe sites, only write out 100F instead of the correct 100°F

from everything-metric.

getsnoopy avatar getsnoopy commented on July 18, 2024

Well the correct formatting would be 100 °F (the space is required), but yes, as an extension, it should be as flexible/forgiving as possible in recognizing units. But that's for the maintainer to decide.

from everything-metric.

MaZZly avatar MaZZly commented on July 18, 2024

Yep, I think it would be best as an optional setting for those who are not as strict with their units :)

For now I just wrote my own lazy TamperMonkey script that does the same:

// ==UserScript==
// @name         F->C convert
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Crude conversion of **F into Celsius equivalent
// @author       You
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    const regex = /(\d+)F/gi;
    const fahrenheitToCelsius = fahrenheit => (fahrenheit - 32) * 5/9;

    var convertUnits = function () {
        let paragraphs = document.querySelectorAll("p");
        function farenheitReplace(match, p1, p2) {
            return p1 + 'F【'+ Math.round(fahrenheitToCelsius(p1)*10)/10 + 'C】';
        }
        for (let i = 0; i < paragraphs.length; i++) {
            paragraphs[i].innerHTML = paragraphs[i].innerHTML.replace(regex, farenheitReplace);
        }
    }
    convertUnits();
})();

from everything-metric.

mirh avatar mirh commented on July 18, 2024

askielboe@e697951

from everything-metric.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.