<commit_before>'use strict';

/* global define */

define('filterBestPrice', require => {
    const Vue = require('vue');

    let filterBestPrice = {};

    const now = new Date();

    let filterBestPriceArticle = article => {
        article.prices = article.prices.filter(price => (price.period.start <= now && now <= price.period.end));

        let min   = Infinity;
        let chosenPrice = null;
        article.prices.forEach(price => {
            if (price.amount < min) {
                min         = price.amount;
                chosenPrice = price;
            }
        });

        Vue.set(article, 'price', chosenPrice);

        return article;
    };

    filterBestPrice.controller = vm => {
        vm.$watch('articles', function () {
            console.info('Finding prices');

            this.articles.forEach(article => filterBestPriceArticle(article));
        });<commit_msg>Coding style<commit_after>'use strict';

/* global define */

define('filterBestPrice', require => {
    const Vue = require('vue');

    let filterBestPrice = {};

    const now = new Date();

    let filterBestPriceArticle = article => {
        article.prices = article.prices.filter(price => (price.period.start <= now && now <= price.period.end));

        let min         = Infinity;
        let chosenPrice = null;
        article.prices.forEach(price => {
            if (price.amount < min) {
                min         = price.amount;
                chosenPrice = price;
            }
        });

        Vue.set(article, 'price', chosenPrice);

        return article;
    };

    filterBestPrice.controller = vm => {
        vm.$watch('articles', function () {
            if (this.silentWatch) {
                return;
            }

            console.info('Finding prices');

            this.articles.forEach(article => filterBestPriceArticle(article));
        });
{'fraction_non_alphanumeric': 0.1331923890063425, 'fraction_numerical': 0.0, 'mean_word_length': 1.898928024502297, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, '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': '6622246', 'n_tokens_mistral': 521, 'n_tokens_neox': 490, 'n_words': 106}