"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const VARIABLE_NAME = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
function variablenamify(name) {
    name = name.replace(/[^0-9a-zA-Z_$]/gi, '_');
    if (!name.match(VARIABLE_NAME)) {
        name = name.replace(/^.{1}/, '_');
    }
    return name;
}
exports.variablenamify = variablenamify;
function arrayMove(arr, old_index, new_index) {
    if (new_index >= arr.length) {
        var k = new_index - arr.length + 1;
        while (k--) {
            // arr.push(undefined);
            throw new Error(`Invalid new index: ${new_index}`);
        }
    }
    arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);
    return arr;
}
exports.arrayMove = arrayMove;
;
//# sourceMappingURL=util.js.map