<commit_before>var util = require("util");
var Type = require('./Type.js').abstract;

function Gauge(name, config){    
    Gauge.super_.call(this,name,config);

    this.defaultType = 'sum';
    this.metric = config.metrics.name;
   // if ( config.from.name ) this.valid[config.from.name] = config.from;

};

util.inherits(Gauge, Type);
Gauge.prototype.payload = function() {    
    var value = this.value(this.metric);
    if ( !value ) return false;

    var from = this.config.from.value;
    if ( !from ) from = this.value(this.config.from.name)
    else return {value:value/from};  
};

exports.type = Gauge;<commit_msg>Finished Gauge and Number, i hope<commit_after>var util = require("util");
var Type = require('./Type.js').abstract;

function Gauge(name, config){    
    Gauge.super_.call(this,name,config);

    this.defaultType = 'sum';
    this.metric = config.metrics.name;

    this.from = config.from;
    if ( !config.from.value ) this.add(config.from);
};

util.inherits(Gauge, Type);
Gauge.prototype.payload = function() {    
    var value = this.value(this.metric);
    if ( !value ) return false;

    if ( !this.from.value ) var from = this.value(this.from.name);
    else var from = {data: this.from.value}; 

    if ( !from.data || !value.data ) return false;
    return {value:value.data/from.data};  
};

exports.type = Gauge;
{'fraction_non_alphanumeric': 0.16236162361623616, 'fraction_numerical': 0.0, 'mean_word_length': 3.3047619047619046, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3173641', 'n_tokens_mistral': 459, 'n_tokens_neox': 450, 'n_words': 94}