export const walk = (value, callback) => {
    callback(value);
    if (typeof value === 'object') {
        if (!value)
            return;
        switch (value.constructor) {
            case Array: {
                const arr = value;
                const length = arr.length;
                for (let i = 0; i < length; i++)
                    walk(arr[i], callback);
                break;
            }
            case Object: {
                const obj = value;
                for (const key in obj)
                    walk(obj[key], callback);
                break;
            }
            case Map:
            case Set: {
                const mapOrSet = value;
                mapOrSet.forEach((val) => walk(val, callback));
                break;
            }
        }
    }
};
//# sourceMappingURL=index.js.map