<commit_before>/*
 * ListFmt.js - Represent a list formatter.
 *
 * Copyright © 2017-2018, JEDLSoft
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// !data list

var ilib = require("../index.js");
var Utils = require("./Utils.js");
var Locale = require("./Locale.js");


/**
 * @class
 * Create a new list formatter object that formats lists of items according to
 * the options.<p>
 *
 * The options object can contain zero or more of the following parameters:
 *
 * <ul>
 * <li><i>type</i> The type of this formatter. Valid values are:
 * <ul>
 *   <ul><i>regular</i> create a regular list.
 *   <ul><i>conjunction</i> this list should be concatenated with "and". This is
 *   the default.
 *   <ul><i>disjunction</i> this list should be concatenated with "or".
 *   <ul><i>unit</i> this is a list of measures like "5 minutes, 4 seconds". In
 *   some languages, these type of lists are concatenated without a conjunction.
 * </ul>
 *
 * <li><i>locale</i> locale to use to format this list, or undefined to use the 
 * default locale
 *
 * <li><i>length</i> - Specify the length of the format to use. The length is the approximate size of the
 * formatted string.
 *
 * <ul>
 * <li><i>short</i>
 * <li><i>medium</i>
 * <li><i>long</i>
 * <li><i>full</i>
 * </ul>
 *
 * <li><i>style</i> the name of style to use to format the list, or undefined
 * to use the default "standard" style. another style option is "units".
 *
 * <li><i>onLoad</i> - a callback function to call when the locale data is fully loaded and the address has been
 * parsed. When the onLoad option is given, the address formatter object
 * will attempt to load any missing locale data using the ilib loader callback.
 * When the constructor is done (even if the data is already preassembled), the
 * onLoad function is called with the current instance as a parameter, so this
 * callback can be used with preassembled or dynamic loading or a mix of the two.
 *
 * <li><i>sync</i> - tell whether to load any missing locale data synchronously or
 * asynchronously. If this option is given as "false", then the "onLoad"
 * callback must be given, as the instance returned from this constructor will
 * not be usable for a while.
 *
 * <li><i>loadParams</i> - an object containing parameters to pass to the
 * loader callback function when locale data is missing. The parameters are not
 * interpretted or modified in any way. They are simply passed along. The object
 * may contain any property/value pairs as long as the calling code is in
 * agreement with the loader callback function as to what those parameters mean.
 * </ul>
 *
 * @constructor
 * @param {Object} options properties that control how this formatter behaves
 */
var ListFmt = function(options) {
<<<<<<< HEAD
    this.locale = new Locale();
    this.sync = true;
    this.style = "standard";
    this.length = "short";
    this.loadParams = {};

    if (options) {
        if (options.locale) {
            this.locale = options.locale;
        }

        if (typeof(options.sync) !== 'undefined') {
            this.sync = !!options.sync;
        }

        if (options.length) {
            this.length = options.length;
        }

        if (options.loadParams) {
            this.loadParams = options.loadParams;
        }

        if (options.style) {
            this.style = options.style;
        }
    }

    Utils.loadData({
        name: "list.json",
        object: "ListFmt",
        locale: this.locale,
        sync: this.sync,
        loadParams: this.loadParams,
        callback: ilib.bind(this, function (fmtdata) {
            this.fmtdata = fmtdata;

            if (options && typeof(options.onLoad) === 'function') {
                options.onLoad(this);
            }
        })
    });
=======
	this.locale = new Locale();
	this.sync = true;
	this.style = "standard";
	this.length = "short";
	this.loadParams = {};
	this.type = "conjunction";
	
	if (options) {
	    if (options.type) {
	        this.type = otions.type;
	    }

		if (options.locale) {
			this.locale = options.locale;
		}

		if (typeof(options.sync) !== 'undefined') {
			this.sync = !!options.sync;<commit_msg>Minor fix<commit_after>/*
 * ListFmt.js - Represent a list formatter.
 *
 * Copyright © 2017-2018, JEDLSoft
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// !data list

var ilib = require("../index.js");
var Utils = require("./Utils.js");
var Locale = require("./Locale.js");


/**
 * @class
 * Create a new list formatter object that formats lists of items according to
 * the options.<p>
 *
 * The options object can contain zero or more of the following parameters:
 *
 * <ul>
 * <li><i>type</i> The type of this formatter. Valid values are:
 * <ul>
 *   <ul><i>regular</i> create a regular list.
 *   <ul><i>conjunction</i> this list should be concatenated with "and". This is
 *   the default.
 *   <ul><i>disjunction</i> this list should be concatenated with "or".
 *   <ul><i>unit</i> this is a list of measures like "5 minutes, 4 seconds". In
 *   some languages, these type of lists are concatenated without a conjunction.
 * </ul>
 *
 * <li><i>locale</i> locale to use to format this list, or undefined to use the 
 * default locale
 *
 * <li><i>length</i> - Specify the length of the format to use. The length is the approximate size of the
 * formatted string.
 *
 * <ul>
 * <li><i>short</i>
 * <li><i>medium</i>
 * <li><i>long</i>
 * <li><i>full</i>
 * </ul>
 *
 * <li><i>style</i> the name of style to use to format the list, or undefined
 * to use the default "standard" style. another style option is "units".
 *
 * <li><i>onLoad</i> - a callback function to call when the locale data is fully loaded and the address has been
 * parsed. When the onLoad option is given, the address formatter object
 * will attempt to load any missing locale data using the ilib loader callback.
 * When the constructor is done (even if the data is already preassembled), the
 * onLoad function is called with the current instance as a parameter, so this
 * callback can be used with preassembled or dynamic loading or a mix of the two.
 *
 * <li><i>sync</i> - tell whether to load any missing locale data synchronously or
 * asynchronously. If this option is given as "false", then the "onLoad"
 * callback must be given, as the instance returned from this constructor will
 * not be usable for a while.
 *
 * <li><i>loadParams</i> - an object containing parameters to pass to the
 * loader callback function when locale data is missing. The parameters are not
 * interpretted or modified in any way. They are simply passed along. The object
 * may contain any property/value pairs as long as the calling code is in
 * agreement with the loader callback function as to what those parameters mean.
 * </ul>
 *
 * @constructor
 * @param {Object} options properties that control how this formatter behaves
 */
var ListFmt = function(options) {
<<<<<<< HEAD
    this.locale = new Locale();
    this.sync = true;
    this.style = "standard";
    this.length = "short";
    this.loadParams = {};

    if (options) {
        if (options.locale) {
            this.locale = options.locale;
        }

        if (typeof(options.sync) !== 'undefined') {
            this.sync = !!options.sync;
        }

        if (options.length) {
            this.length = options.length;
        }

        if (options.loadParams) {
            this.loadParams = options.loadParams;
        }

        if (options.style) {
            this.style = options.style;
        }
    }

    Utils.loadData({
        name: "list.json",
        object: "ListFmt",
        locale: this.locale,
        sync: this.sync,
        loadParams: this.loadParams,
        callback: ilib.bind(this, function (fmtdata) {
            this.fmtdata = fmtdata;

            if (options && typeof(options.onLoad) === 'function') {
                options.onLoad(this);
            }
        })
    });
=======
	this.locale = new Locale();
	this.sync = true;
	this.style = "standard";
	this.length = "short";
	this.loadParams = {};
	this.type = "conjunction";
	
	if (options) {
	    if (options.type) {
	        this.type = options.type;
	    }

		if (options.locale) {
			this.locale = options.locale;
		}

		if (typeof(options.sync) !== 'undefined') {
			this.sync = !!options.sync;
{'fraction_non_alphanumeric': 0.11629653470657655, 'fraction_numerical': 0.003003969531166184, 'mean_word_length': 2.8393739703459637, 'pattern_counts': {'":': 0, '<': 121, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4072768', 'n_tokens_mistral': 2760, 'n_tokens_neox': 2656, 'n_words': 1064}