Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 041d586
  • /
  • model
  • /
  • model_format_datatypes.js
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:ccdf3e6ceea4a0bbd2e2ad679857a269d76ea0cd
directory badge
swh:1:dir:afc4d6d3ec61f1e72dacbe98843f2f249093a47d

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
model_format_datatypes.js
/**
 * This function formats the columns regarding the pre-defined datatypes
 * @param columns
 */
function format_datatypes_regarding_datatype(columns) {


    for (let i = 0; i < columns.length; i++) {
        let col = columns[i];

        col[changes_key_datatype_change] = false;

        if (column_values_initially.length>0) {
            col[changes_key_datatype_change] = col[key_data_type] !== column_values_initially.find(col_initially => col[key_id] === col_initially[key_id])[key_data_type];
        }

        col[key_removed_during_data_formatting] = [];

        // convert strings to numbers for numerical identified columns
        if (col[key_data_type] === id_data_type__numerical) {
            for (let index_data = 0; index_data < col[key_column_values].length; index_data++) {

                if (col[key_column_values][index_data] === undefined || col[key_column_values][index_data] === "" || isNaN(col[key_column_values][index_data]) || col[key_column_values][index_data] === null) {

                    if (col[key_removed_during_data_formatting].indexOf(col[key_column_values][index_data]) === -1) {
                        col[key_removed_during_data_formatting].push(col[key_column_values][index_data]);
                    }
                    col[key_column_values][index_data] = undefined;
                } else {
                    col[key_column_values][index_data] = parseFloat(col[key_column_values][index_data]);
                }
            }
        }


        // convert strings to date
        if (col[key_data_type] === id_data_type__date) {
            for (let index_data = 0; index_data < col[key_column_values].length; index_data++) {
                if (col[key_column_values][index_data] !== undefined) {
                    let dd_mm_yyyy = col[key_column_values][index_data].split('.');

                    // convert to numbers
                    dd_mm_yyyy.forEach(function (d) {
                        d = +d;
                    });


                    if (col[key_column_values][index_data] === "" || col[key_column_values][index_data].split('.').length < 3) {
                        if (col[key_removed_during_data_formatting].indexOf(col[key_column_values][index_data]) === -1) {
                            col[key_removed_during_data_formatting].push(col[key_column_values][index_data]);
                        }
                        col[key_column_values][index_data] = undefined;
                    } else {
                        col[key_column_values][index_data] = new Date(dd_mm_yyyy[2], dd_mm_yyyy[1] - 1, dd_mm_yyyy[0]).getTime();
                    }
                }
            }
        }

        if (col[key_data_type] === id_data_type__categorical) {
            for (let index_data = 0; index_data < col[key_column_values].length; index_data++) {

                if (col[key_column_values][index_data] === undefined || col[key_column_values][index_data] === "" ||col[key_column_values][index_data] === null) {
                    col[key_column_values][index_data] = undefined;
                }
            }
        }

    }


    return get_descriptive_statistical_measures(columns);
}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API