-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- deleteAllTags now takes a retain array - add tests for deleteAllTags with and without tag retention - add js docs for Tag interfaces - shove the orphan Tag fields into correct sub-interfaces - export `isExifToolTag`, `isGeolocationTag`, ...
- Loading branch information
Showing
13 changed files
with
460 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
import { keysOf } from "./Object" | ||
import { ExifToolTags } from "./Tags" | ||
|
||
export const ExifToolTagNames = keysOf<ExifToolTags>({ | ||
ExifToolVersion: true, | ||
SourceFile: true, | ||
Error: true, | ||
Warning: true, | ||
}) | ||
|
||
/** | ||
* Is the given tag name intrinsic to the content of a given file? In other | ||
* words, is it not an artifact of a metadata field? | ||
*/ | ||
export function isExifToolTag(name: string): name is keyof ExifToolTags { | ||
return ExifToolTagNames.includes(name as any) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { ErrorsAndWarnings } from "./ErrorsAndWarnings" | ||
import { keysOf } from "./Object" | ||
|
||
/** | ||
* This tags are added to {@link Tags} from this library. | ||
*/ | ||
export interface ExifToolVendoredTags extends ErrorsAndWarnings { | ||
/** | ||
* Either an offset, like `UTC-7`, or an actual IANA timezone, like | ||
* `America/Los_Angeles`. | ||
* | ||
* This will be missing if we can't intuit a timezone from the metadata. | ||
*/ | ||
tz?: string | ||
|
||
/** | ||
* Description of where and how `tz` was extracted | ||
*/ | ||
tzSource?: string | ||
} | ||
|
||
export const ExifToolVendoredTagNames = keysOf<ExifToolVendoredTags>({ | ||
tz: true, | ||
tzSource: true, | ||
errors: true, | ||
warnings: true, | ||
}) | ||
|
||
/** | ||
* Is the given tag name intrinsic to the content of a given file? In other | ||
* words, is it not an artifact of a metadata field? | ||
*/ | ||
export function isExifToolVendoredTag( | ||
name: string | ||
): name is keyof ExifToolVendoredTags { | ||
return ExifToolVendoredTagNames.includes(name as any) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { keysOf } from "./Object" | ||
import { FileTags } from "./Tags" | ||
|
||
const FileTagNames = keysOf<FileTags>({ | ||
BMPVersion: true, | ||
BitsPerSample: true, | ||
ColorComponents: true, | ||
CurrentIPTCDigest: true, | ||
Directory: true, | ||
EncodingProcess: true, | ||
ExifByteOrder: true, | ||
FileAccessDate: true, | ||
FileInodeChangeDate: true, | ||
FileModifyDate: true, | ||
FileName: true, | ||
FilePermissions: true, | ||
FileSize: true, | ||
FileType: true, | ||
FileTypeExtension: true, | ||
ImageDataMD5: true, | ||
ImageHeight: true, | ||
ImageWidth: true, | ||
MIMEType: true, | ||
NumColors: true, | ||
NumImportantColors: true, | ||
PixelsPerMeterX: true, | ||
PixelsPerMeterY: true, | ||
Planes: true, | ||
YCbCrSubSampling: true, | ||
}) | ||
|
||
/** | ||
* Is the given tag name intrinsic to the content of a given file? In other | ||
* words, is it not an artifact of a metadata field? | ||
*/ | ||
export function isFileTag(name: string): name is keyof FileTags { | ||
return FileTagNames.includes(name as any) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.