Commit graph

64 commits

Author SHA1 Message Date
ProfessorDey
40ae42c5f6
Simplify Media Identification Function
Rebased from LBRY/lbry-app PR# 1304 with corrections requested by Codacy (Though may still complain regarding spacing).

This just makes the code for finding documents a lot easier. the regex patterns and the media type are converted into keypairs, [regex, mediatype] which is then reduced to a single value, which will either be the original filename if there are no matching extensions, or the mediatype. So long as the mediatype does not contain an extension at the end of the string, this system should work far more simply.

This will also allow for easier addition of new extensions to the function, so long as they all follow the same pattern for the regex:
^ = Start of string
.+ = 1 or more characters of any type
. = A literal dot
(a|b|c) = A list of ORed extensions within a capture group '( )'
$ = End of string, so it is certain this is the actual extension of the filename

Won't be hard to add things like Archives, Executables, etc with just a single extra line now.
2018-04-19 17:59:24 +00:00
Igor Gassmann
1a2c4645c5 chore: final cleanup 2018-04-05 14:00:21 -04:00
Sean Yesmunt
800083dc24
Merge pull request #4 from lbryio/search-fix
fix: check that claim exists before checking value
2018-04-05 11:46:42 -04:00
Sean Yesmunt
006963322e fix: check that claim exists before checking value 2018-04-05 11:45:17 -04:00
Igor Gassmann
2e0752286f chore: clean gitignore file 2018-04-05 11:29:14 -04:00
Igor Gassmann
c7d65ad378 fix: linting errors 2018-04-05 11:27:29 -04:00
Igor Gassmann
950277f243 fix: commit Yarn lock file 2018-04-05 11:22:16 -04:00
Igor Gassmann
915acacf6c feat: add ESLint as a githook 2018-04-05 11:21:43 -04:00
akinwale
6418b5a9f2
Common components refactor (#1) 2018-04-05 03:57:29 +01:00
Alex Grin
8f766fa930
Merge pull request #2 from lbrydocs/patch-1
create initial LICENSE file
2018-02-28 09:41:18 -05:00
LBRY Docs
773b317208
create initial LICENSE file 2018-02-05 12:49:16 -08:00
Akinwale Ariwodola
57e5b4a086 added lbryapi.js and removed electron-specific code from lbry.js 2018-01-15 19:06:44 +01:00
Akinwale Ariwodola
e127e3c38d updated index for cost_info reducer 2018-01-11 13:12:37 +01:00
Akinwale Ariwodola
cf9b0cfdaf Initial commit 2018-01-11 12:54:20 +01:00