<commit_before><!DOCTYPE html>
<html>
<head>
  <title>math.js | currency conversion</title>

  <script src="../../dist/math.js"></script>

  <style>
    body,
    html,
    input {
      font-size: 11pt;
      font-family: verdana, arial, sans-serif;
      color: #4d4d4d;
      max-width: 600px;
    }

    h1 {
      font-size: 120%;
    }

    input {
      padding: 5px;
      width: 400px;
    }
  </style>
</head>
<body>

<h1>Currency conversion with math.js</h1>

<p>
  This example demonstrates how you can fetch actual currencies from <a href="http://fixer.io">fixer.io</a> and use them in math.js.
</p>

<p id="info">
  fetching currencies...
</p>
<p>
  <label for="expr">Enter an expression with currencies:</label>
</p>
<div id="form" style="display: none;">
  <p>
    <input id="expr" value="5 EUR + 2 * 3 EUR in USD" /><br/>
  </p>
  <p id="result"></p>
</div>

<script>
  fetchAndImportCurrencies()
      .then(function (currencies) {
        document.getElementById('expr').oninput = evaluate;
        document.getElementById('form').style.display = '';
        document.getElementById('info').innerHTML = 'Available currencies: ' + currencies.join(', ');

        evaluate();
      })

  function fetchAndImportCurrencies () {
    // fetch actual currency conversion rates
    return fetch('http://api.fixer.io/latest')
        .then(function (response) {
          return response.json();
        }).then(function (data) {
          // import the currencies
          math.createUnit(data.base)
          Object.keys(data.rates).forEach(function (currency) {<commit_msg>https url instead of http<commit_after><!DOCTYPE html>
<html>
<head>
  <title>math.js | currency conversion</title>

  <script src="../../dist/math.js"></script>

  <style>
    body,
    html,
    input {
      font-size: 11pt;
      font-family: verdana, arial, sans-serif;
      color: #4d4d4d;
      max-width: 600px;
    }

    h1 {
      font-size: 120%;
    }

    input {
      padding: 5px;
      width: 400px;
    }
  </style>
</head>
<body>

<h1>Currency conversion with math.js</h1>

<p>
  This example demonstrates how you can fetch actual currencies from <a href="http://fixer.io">fixer.io</a> and use them in math.js.
</p>

<p id="info">
  fetching currencies...
</p>
<p>
  <label for="expr">Enter an expression with currencies:</label>
</p>
<div id="form" style="display: none;">
  <p>
    <input id="expr" value="5 EUR + 2 * 3 EUR in USD" /><br/>
  </p>
  <p id="result"></p>
</div>

<script>
  fetchAndImportCurrencies()
      .then(function (currencies) {
        document.getElementById('expr').oninput = evaluate;
        document.getElementById('form').style.display = '';
        document.getElementById('info').innerHTML = 'Available currencies: ' + currencies.join(', ');

        evaluate();
      })

  function fetchAndImportCurrencies () {
    // fetch actual currency conversion rates
    return fetch('https://api.fixer.io/latest')
        .then(function (response) {
          return response.json();
        }).then(function (data) {
          // import the currencies
          math.createUnit(data.base)
          Object.keys(data.rates).forEach(function (currency) {
{'fraction_non_alphanumeric': 0.1643148322358106, 'fraction_numerical': 0.01317027281279398, 'mean_word_length': 2.679354094579008, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 67, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3618317', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1014, 'n_words': 248}