"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function mapSet(set, fn) {
    const output = [];
    set.forEach(key => output.push(fn(key)));
    return output;
}
exports.mapSet = mapSet;
function mapMap(map, fn) {
    const output = [];
    map.forEach((value, key) => output.push(fn(value, key)));
    return output;
}
exports.mapMap = mapMap;
function forKeys(obj, fn) {
    Object.keys(obj).forEach(fn);
}
exports.forKeys = forKeys;
function omit(obj, values) {
    const output = {};
    Object.keys(obj).forEach((key) => {
        if (values.indexOf(key) === -1) {
            output[key] = obj[key];
        }
    });
    return output;
}
exports.omit = omit;
function setSub(source, ...subs) {
    const out = new Set();
    source.forEach(key => {
        if (!subs.some(s => s.has(key))) {
            out.add(key);
        }
    });
    return out;
}
exports.setSub = setSub;
function exists(value) {
    return value != null;
}
exports.exists = exists;
function unindent(message) {
    const match = /\n?( *)/.exec(message);
    if (!match) {
        return message;
    }
    const re = new RegExp(`^ {${match[1].length}}`, 'mg');
    return message.replace(re, '').trim();
}
exports.unindent = unindent;
