<commit_before>/**
 *
 * The Output manager handles all data output plugins
 *
 * (c) 2014 <NAME>, <EMAIL>
 * All rights reserved.
 */

define(function(require) {
    
    "use strict";
    
    var _ = require('underscore'),
        Backbone = require('backbone'),
        Instrument = require(['app/models/instrument']);
    
    var Safecast = require('app/outputs/safecast/safecast');
    var SafecastSettings = require('app/outputs/safecast/settings');
    var Rest     = require('app/outputs/rest/rest');
    var RestSettings = require('app/outputs/rest/settings');

    var OutputManager = function() {
        
        // Private utility functions
        
        // Returns 'true' if alarm is triggered
        var check_alarm = function(output, alarm, data) {
            if (alarm.field != "_unused" && alarm.field != "") {
                var value = output.plugin.resolveMapping(alarm.field, data);
                if (value != undefined) {<commit_msg>Enforce numeric comparison on alarms if possible.<commit_after>/**
 *
 * The Output manager handles all data output plugins
 *
 * (c) 2014 <NAME>, <EMAIL>
 * All rights reserved.
 */

define(function(require) {
    
    "use strict";
    
    var _ = require('underscore'),
        Backbone = require('backbone'),
        Instrument = require(['app/models/instrument']);
    
    var Safecast = require('app/outputs/safecast/safecast');
    var SafecastSettings = require('app/outputs/safecast/settings');
    var Rest     = require('app/outputs/rest/rest');
    var RestSettings = require('app/outputs/rest/settings');

    var OutputManager = function() {
        
        // Private utility functions
        
        // Returns 'true' if alarm is triggered
        var check_alarm = function(output, alarm, data) {
            if (alarm.field != "_unused" && alarm.field != "") {
                var value = output.plugin.resolveMapping(alarm.field, data);
                if (value != undefined) {
                    // If both field and alarm.level can be parsed as
                    // numbers, do it (we might have numbers as strings on both sides
                    // which will lead to a wrong comparison)
                    var numval = parseFloat(field);
                    if (!isNaN(numval))
                        field = numval;
                    numval = parseFloat(alarm.level);
                    if (!isNaN(numval))
                        alarm.level = numval;
{'fraction_non_alphanumeric': 0.12001627339300244, 'fraction_numerical': 0.0032546786004882017, 'mean_word_length': 2.054658385093168, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7138958', 'n_tokens_mistral': 675, 'n_tokens_neox': 634, 'n_words': 177}