All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.app.shared.pipes.distinct.pipe.ts Maven / Gradle / Ivy

The newest version!
/*
 * SPDX-FileCopyrightText: 2017-2024 Enedis
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 */

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
    name: 'distinct'
})
export class DistinctPipe implements PipeTransform {

    transform(values: any [], property: string = null): any [] {
        return values.filter((value, index, self) =>
            index === self.findIndex(other =>other[property] === value[property]));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy