function handle(cursor, ids, _tag) {

    const arr = cursor.value;
    let changed,
        count = 0;


    for (let x = 0, result; x < arr.length; x++) {

        if (result = _tag ? arr : arr[x]) {
            for (let i = 0, pos, id; i < ids.length; i++) {
                id = ids[i];
                pos = result.indexOf(id);
                if (0 <= pos) {
                    changed = 1;
                    if (1 < result.length) {
                        result.splice(pos, 1);
                    } else {
                        arr[x] = [];
                        break;
                    }
                }
            }

            count += result.length;
        }
        if (_tag) break;
    }

    if (!count) {
        cursor.delete();
    } else if (changed) {

        cursor.update(arr);
    }

    cursor.continue();
}
@param {IDBCursorWithValue} cursor
@param {Array<number|string>} ids
@param {boolean=} _tag