Skip to content

Commit

Permalink
Fixed getMatchingAspect
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitrinicolas committed Aug 27, 2018
1 parent 8a77509 commit 8e4ed3b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,10 @@
# Change Log
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.2.1 - 2018-08-27
### Fixed
- getMatchingAspect duplicates.

## 1.2.0 - 2018-08-27
### Removed
- Two resolution duplicates.
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "video-resolutions",
"version": "1.2.0",
"version": "1.2.1",
"description": "Search into a local database of 183 video resolutions and aspect-ratio",
"main": "src/index.js",
"author": "Dimitri NICOLAS <dimitri@fivecorp.fr>",
Expand Down
14 changes: 14 additions & 0 deletions src/format.js
Expand Up @@ -106,6 +106,20 @@ class Format {
}
return new Format(copy);
}

isSameAs(format) {
return (
this.code === format.code
&& this.name === format.name
&& this.fullName === format.fullName
&& this.alternativeNames.join(', ') === format.alternativeNames.join(', ')
&& this.width === format.width
&& this.height === format.height
&& this.aspects.storage.string === format.aspects.storage.string
&& this.aspects.display.string === format.aspects.display.string
&& this.aspects.pixel.string === format.aspects.pixel.string
);
}
}

module.exports = Format;
2 changes: 1 addition & 1 deletion src/getters.js
Expand Up @@ -85,7 +85,7 @@ const getMatchingAspect = (format, aspect = DEFAULT_ASPECT) => {
};
query.aspects[aspect] = format.aspects[aspect].string;
const result = getAll(query);
return result.filter(item => format !== item);
return result.filter(item => !format.isSameAs(item));
};

module.exports = {
Expand Down

0 comments on commit 8e4ed3b

Please sign in to comment.