<commit_before>var semver = require('semver');
var createError = require('./createError');

function decompose(endpoint) {
    var regExp = /^(?:([\w\-]|(?:[\w\.\-]+[\w\-])?)\|)?([^\|#]+)(?:#(.*))?$/;
    var matches = endpoint.match(regExp);

    if (!matches) {
        throw createError('Invalid endpoint: "' + endpoint + '"', 'EINVEND');
    }

    return {
        name: matches[1] || '',
        source: matches[2],
        target: matches[3] || '*'
    };
}

function compose(decEndpoint) {
    var composed = '';

    if (decEndpoint.name) {
        composed += decEndpoint.name + '|';
    }

    composed += decEndpoint.source;

    if (decEndpoint.target) {
        composed += '#' + decEndpoint.target;
    }

    return composed;
}

function json2decomposed(key, value) {
    var endpoint = key + '|';

    if (semver.valid(value) != null || semver.validRange(value) != null) {
        endpoint += key + '#' + value;<commit_msg>Change name separator of the endpoint (can't use pipe duh).<commit_after>var semver = require('semver');
var createError = require('./createError');

function decompose(endpoint) {
    var regExp = /^(?:([\w\-]|(?:[\w\.\-]+[\w\-])?)=)?([^\|#]+)(?:#(.*))?$/;
    var matches = endpoint.match(regExp);

    if (!matches) {
        throw createError('Invalid endpoint: "' + endpoint + '"', 'EINVEND');
    }

    return {
        name: matches[1] || '',
        source: matches[2],
        target: matches[3] || '*'
    };
}

function compose(decEndpoint) {
    var composed = '';

    if (decEndpoint.name) {
        composed += decEndpoint.name + '=';
    }

    composed += decEndpoint.source;

    if (decEndpoint.target) {
        composed += '#' + decEndpoint.target;
    }

    return composed;
}

function json2decomposed(key, value) {
    var endpoint = key + '=';

    if (semver.valid(value) != null || semver.validRange(value) != null) {
        endpoint += key + '#' + value;
{'fraction_non_alphanumeric': 0.2083116883116883, 'fraction_numerical': 0.004155844155844156, 'mean_word_length': 2.718146718146718, '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': '2102850', 'n_tokens_mistral': 643, 'n_tokens_neox': 621, 'n_words': 124}