JSPM

  • Created
  • Published
  • Downloads 87
  • Score
    100M100P100Q71909F
  • License MIT

Functional Types for Entities' functions

Package Exports

  • functional-types
  • functional-types/lib/FileType
  • functional-types/lib/Folder
  • functional-types/lib/TableAnnotation

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (functional-types) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

functional-types

functional-types

Index

Modules

functional-types

functional-types

Interfaces

functional-types"Folder/index"Attributes

Interface: Attributes

Hierarchy

  • Attributes

Index

Properties

Properties

folder

folder: string

Defined in Folder/index.ts:29


id

id: string

Defined in Folder/index.ts:28


name

name: string

Defined in Folder/index.ts:30


type

type: FT.FileType

Defined in Folder/index.ts:31

functional-types"Folder/index"Folder

Interface: Folder

Hierarchy

  • Folder

Index

Properties

Properties

created_at

created_at: string

Defined in Folder/index.ts:23


id

id: string

Defined in Folder/index.ts:21


name

name: string

Defined in Folder/index.ts:22


updated_at

updated_at: string

Defined in Folder/index.ts:24

functional-types"Folder/index"Metadata

Interface: Metadata

Hierarchy

  • Metadata

Index

Properties

Properties

bucket

bucket: string

Defined in Folder/index.ts:40


content_type

content_type: string

Defined in Folder/index.ts:42


created_at

created_at: string

Defined in Folder/index.ts:44


generation

generation: string

Defined in Folder/index.ts:41


id

id: string

Defined in Folder/index.ts:36


kind

kind: string

Defined in Folder/index.ts:35


media_link: string

Defined in Folder/index.ts:38


name

name: string

Defined in Folder/index.ts:39


self_link: string

Defined in Folder/index.ts:37


size

size: string

Defined in Folder/index.ts:43


updated_at

updated_at: string

Defined in Folder/index.ts:45

functional-types"Label"Label

Interface: Label

Hierarchy

  • Label

Index

Properties

Properties

color

color: string

Defined in Label.ts:6


id

id: string

Defined in Label.ts:4


name

name: string

Defined in Label.ts:5

functional-types"TableAnnotation"TableAnnotation

Interface: TableAnnotation

Hierarchy

  • TableAnnotation

Index

Properties

Properties

boundingBoxesByPageId

boundingBoxesByPageId: BoundingBoxByPageId

Defined in TableAnnotation.ts:10


created_at

created_at: string

Defined in TableAnnotation.ts:11


file

file: string

Defined in TableAnnotation.ts:9


id

id: string

Defined in TableAnnotation.ts:8


updated_at

updated_at: string

Defined in TableAnnotation.ts:12

functional-types"Vertex/index"BoundingBox

Interface: BoundingBox

Hierarchy

Index

Properties

Properties

boundingPoly

boundingPoly: Poly

Defined in Vertex/index.ts:47


columns

columns: Line[]

Defined in Vertex/index.ts:49


rows

rows: Line[]

Defined in Vertex/index.ts:48

functional-types"Vertex/index"Corners

Interface: Corners

Hierarchy

  • Corners

Index

Properties

Properties

end

end: Vertex

Defined in Vertex/index.ts:71


start

start: Vertex

Defined in Vertex/index.ts:70

functional-types"Vertex/index"LabeledBoundingBox

Interface: LabeledBoundingBox

Hierarchy

Index

Properties

Properties

boundingPoly

boundingPoly: Poly

Inherited from BoundingBox.boundingPoly

Defined in Vertex/index.ts:47


columns

columns: Line[]

Inherited from BoundingBox.columns

Defined in Vertex/index.ts:49


id

id: string

Defined in Vertex/index.ts:65


label

label: string

Defined in Vertex/index.ts:66


rows

rows: Line[]

Inherited from BoundingBox.rows

Defined in Vertex/index.ts:48

functional-types"Vertex/index"Vertex

Interface: Vertex

Hierarchy

  • Vertex

Index

Properties

Properties

x

x: number

Defined in Vertex/index.ts:35


y

y: number

Defined in Vertex/index.ts:36

Modules

functional-types"DateTime"

Module: "DateTime"

Index

Variables

Functions

Variables

Const getCurrentUnixTimestamp

getCurrentUnixTimestamp: function = Date.now

Defined in DateTime.ts:14

getCurrentUnixTimestamp :: () -> Int
Type declaration:

▸ (): number

Functions

Const getCurrentDate

getCurrentDate(): Date

Defined in DateTime.ts:16

Returns: Date


Const getUnixTimestamp

getUnixTimestamp(date: Date): number

Defined in DateTime.ts:6

getUnixTimestamp :: Date -> Int

Parameters:

Name Type
date Date

Returns: number

functional-types"FileType"

Module: "FileType"

Index

Type aliases

Variables

Functions

Type aliases

ContentType

Ƭ ContentType: DocumentContentType | ImageContentType

Defined in FileType.ts:26


DocumentContentType

Ƭ DocumentContentType: "application/pdf" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/json"

Defined in FileType.ts:19


DocumentType

Ƭ DocumentType: "pdf" | "excel" | "json"

Defined in FileType.ts:13


FileType

Ƭ FileType: DocumentType | ImageType

Defined in FileType.ts:17


ImageContentType

Ƭ ImageContentType: "image/png" | "image/jpeg"

Defined in FileType.ts:24


ImageType

Ƭ ImageType: "png" | "jpeg"

Defined in FileType.ts:15

Variables

Const contentTypes

contentTypes: ContentType[] = values(FileTypeToContentType)

Defined in FileType.ts:151

contentTypes: [ContentType]

Const documentTypes

documentTypes: DocumentType[] = keys(DocumentTypeToContentType)

Defined in FileType.ts:112

documentTypes: [DocumentType]

Const fileContentTypes

fileContentTypes: DocumentContentType[] = values( DocumentTypeToContentType )

Defined in FileType.ts:133

contentTypes: [DocumentContentType]

Const fileTypes

fileTypes: FileType[] = keys(FileTypeToContentType)

Defined in FileType.ts:126

fileTypes: [FileType]

Const fromContentType

fromContentType: function = prop( __, ContentTypeToFileType )

Defined in FileType.ts:252

fromContentType :: ContentType -> FileType
Type declaration:

▸ (contentType: ContentType): FileType

Parameters:

Name Type
contentType ContentType

Const fromDocumentContentType

fromDocumentContentType: function = prop(__, ContentTypeToDocumentType)

Defined in FileType.ts:234

fromDocumentContentType :: DocumentContentType -> DocumentType
Type declaration:

▸ (contentType: DocumentContentType): DocumentType

Parameters:

Name Type
contentType DocumentContentType

Const fromImageContentType

fromImageContentType: function = prop(__, ContentTypeToImageType)

Defined in FileType.ts:243

fromImageContentType :: DocumentContentType -> DocumentType
Type declaration:

▸ (contentType: ImageContentType): ImageType

Parameters:

Name Type
contentType ImageContentType

Const imageContentTypes

imageContentTypes: ImageContentType[] = values( ImageTypeToContentType )

Defined in FileType.ts:142

imageContentTypes: [DocumentContentType]

Const imageTypes

imageTypes: ImageType[] = keys(ImageTypeToContentType)

Defined in FileType.ts:119

imageTypes: [DocumentType]

Const toContentType

toContentType: function = prop( __, FileTypeToContentType )

Defined in FileType.ts:224

toContentType :: FileType -> ContentType
Type declaration:

▸ (fileType: FileType): ContentType

Parameters:

Name Type
fileType FileType

Const toDocumentContentType

toDocumentContentType: function = prop(__, DocumentTypeToContentType)

Defined in FileType.ts:206

toDocumentContentType :: DocumentType -> DocumentContentType
Type declaration:

▸ (fileType: DocumentType): DocumentContentType

Parameters:

Name Type
fileType DocumentType

Const toImageContentType

toImageContentType: function = prop(__, ImageTypeToContentType)

Defined in FileType.ts:215

toImageContentType :: DocumentType -> ImageContentType
Type declaration:

▸ (imageType: ImageType): ImageContentType

Parameters:

Name Type
imageType ImageType

Functions

Const isContentType

isContentType(a: unknown): a is ContentType

Defined in FileType.ts:198

isContentType :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is ContentType


Const isDocumentContentType

isDocumentContentType(a: unknown): a is DocumentContentType

Defined in FileType.ts:182

isDocumentContentType :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is DocumentContentType


Const isDocumentType

isDocumentType(a: unknown): a is DocumentType

Defined in FileType.ts:158

isDocumentType :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is DocumentType


Const isFileType

isFileType(a: unknown): a is ImageType

Defined in FileType.ts:174

isFileType :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is ImageType


Const isImageContentType

isImageContentType(a: unknown): a is ImageContentType

Defined in FileType.ts:190

isDocumentContentType :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is ImageContentType


Const isImageType

isImageType(a: unknown): a is ImageType

Defined in FileType.ts:166

isImageType :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is ImageType

functional-types"Folder/Arbitraries"

Module: "Folder/Arbitraries"

Index

Functions

Functions

Const file

file(): Arbitrary‹File

Defined in Folder/Arbitraries.ts:47

Returns: Arbitrary‹File


Const filesByType

filesByType(): Arbitrary‹FilesByType

Defined in Folder/Arbitraries.ts:57

Returns: Arbitrary‹FilesByType


Const folder

folder(): Arbitrary‹Folder

Defined in Folder/Arbitraries.ts:29

Returns: Arbitrary‹Folder


Const invalidFolderObject

invalidFolderObject(): Arbitrary‹Record‹string, any››

Defined in Folder/Arbitraries.ts:5

Returns: Arbitrary‹Record‹string, any››


Const metadata

metadata(): Arbitrary‹Metadata

Defined in Folder/Arbitraries.ts:32

Returns: Arbitrary‹Metadata


Const nonFolderObject

nonFolderObject(): Arbitrary‹unknown›

Defined in Folder/Arbitraries.ts:15

Returns: Arbitrary‹unknown›

functional-types"Folder/index"

Module: "Folder/index"

Index

Interfaces

Type aliases

Variables

Functions

Type aliases

File

Ƭ File: Attributes & object

Defined in Folder/index.ts:48


FilesByType

Ƭ FilesByType: Record‹FT.DocumentType, File[]›

Defined in Folder/index.ts:50

Variables

Const getAttributesFromName

getAttributesFromName: function = pipe( split('/'), E.fromPredicate( (segments: string[]) => segments.length >= 2, () => new Error('Invalid file name format.') ), E.map(([folder, ...names]: string[]) => { const name = names.join('/'); return { id: join('/')([folder, name]), folder, name, }; }) )

Defined in Folder/index.ts:157

getAttributesFromName :: String -> Either Attributes Error
Type declaration:

▸ (name: string): E.Either‹Error, Omit‹Attributes, "type"››

Parameters:

Name Type
name string

Functions

Const fromMetadata

fromMetadata(metadata: Metadata): Left‹Error› | Right‹object›

Defined in Folder/index.ts:180

fromMetadata :: Metadata -> Either

Parameters:

Name Type
metadata Metadata

Returns: Left‹Error› | Right‹object›


Const isFile

isFile(a: unknown): a is File

Defined in Folder/index.ts:130

isFile :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is File


Const isFileArray

isFileArray(a: unknown): a is File[]

Defined in Folder/index.ts:138

isFileArray :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is File[]


Const isFilesByType

isFilesByType(a: unknown): a is FilesByType

Defined in Folder/index.ts:146

isFilesByType :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is FilesByType


Const isFolder

isFolder(a: unknown): a is Folder

Defined in Folder/index.ts:57

isFolder -> bool

Parameters:

Name Type
a unknown

Returns: a is Folder


Const isMetadata

isMetadata(a: unknown): a is Metadata

Defined in Folder/index.ts:107

isMetadata :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is Metadata


Const make

make(name: string): (Anonymous function)

Defined in Folder/index.ts:71

make :: String -> Folder

Parameters:

Name Type
name string

Returns: (Anonymous function)

functional-types"index"

Module: "index"

Index

References

References

F

F:


FT

FT:


L

L:


T

T:


V

V:

functional-types"Label"

Module: "Label"

Index

Interfaces

Type aliases

Variables

Functions

Type aliases

ColorMappings

Ƭ ColorMappings: Record‹string, string›

Defined in Label.ts:9

Variables

Const toColorMappings

toColorMappings: function = reduce( (acc: ColorMappings, label: Label) => assoc(label.id, label.color)(acc), {} )

Defined in Label.ts:29

toColorMappings :: [Label] -> ColorMappings
Type declaration:

▸ (labels: Label[]): ColorMappings

Parameters:

Name Type
labels Label[]

Functions

Const isLabel

isLabel(a: unknown): a is Label

Defined in Label.ts:16

isLabel :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is Label

functional-types"String"

Module: "String"

Index

Variables

Variables

Const getRandomId

getRandomId: IO‹string› = uuid

Defined in String.ts:9

getRandomId: IO String

functional-types"TableAnnotation"

Module: "TableAnnotation"

Index

Interfaces

Type aliases

Functions

Type aliases

BoundingBoxByPageId

Ƭ BoundingBoxByPageId: Record‹string, LabeledBoundingBox

Defined in TableAnnotation.ts:5


TableAnnotationBase

Ƭ TableAnnotationBase: Pick‹TableAnnotation, "file" | "boundingBoxesByPageId"›

Defined in TableAnnotation.ts:15

Functions

Const isBoundingBoxByPageId

isBoundingBoxByPageId(a: unknown): a is BoundingBoxByPageId

Defined in TableAnnotation.ts:25

isBoundingBoxByPageId :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is BoundingBoxByPageId


Const isTableAnnotation

isTableAnnotation(a: unknown): a is TableAnnotation

Defined in TableAnnotation.ts:47

isTableAnnotation :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is TableAnnotation


Const isTableAnnotationBase

isTableAnnotationBase(a: unknown): a is TableAnnotationBase

Defined in TableAnnotation.ts:35

isTableAnnotationBase :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is TableAnnotationBase


Const make

make(__namedParameters: object): (Anonymous function)

Defined in TableAnnotation.ts:62

make :: (String, BoundingBoxByPageId) -> IO TableAnnotation

Parameters:

__namedParameters: object

Name Type
boundingBoxesByPageId object
file string

Returns: (Anonymous function)

functional-types"Vertex/Arbitraries"

Module: "Vertex/Arbitraries"

Index

Functions

Functions

Const boundingBox

boundingBox(): Arbitrary‹BoundingBox

Defined in Vertex/Arbitraries.ts:23

Returns: Arbitrary‹BoundingBox


Const poly

poly(): Arbitrary‹Poly

Defined in Vertex/Arbitraries.ts:20

Returns: Arbitrary‹Poly


Const vertex

vertex(): Arbitrary‹Vertex

Defined in Vertex/Arbitraries.ts:14

Returns: Arbitrary‹Vertex


Const withHeaderArguments

withHeaderArguments(): Arbitrary‹object›

Defined in Vertex/Arbitraries.ts:35

Returns: Arbitrary‹object›

functional-types"Vertex/index"

Module: "Vertex/index"

Index

Interfaces

Type aliases

Variables

Functions

Type aliases

Line

Ƭ Line: [Vertex, Vertex]

Defined in Vertex/index.ts:39


Poly

Ƭ Poly: [Vertex, Vertex, Vertex, Vertex]

Defined in Vertex/index.ts:44

[TopLeft, TopRight, BottomLeft, BottomRight]


WithHeader

Ƭ WithHeader: WithHeaderRow‹A› | WithHeaderColumn‹A›

Defined in Vertex/index.ts:60


WithHeaderColumn

Ƭ WithHeaderColumn: A & object

Defined in Vertex/index.ts:56


WithHeaderRow

Ƭ WithHeaderRow: A & object

Defined in Vertex/index.ts:52

Variables

Const getBottomLeft

getBottomLeft: function = nth(2)

Defined in Vertex/index.ts:392

getBottomLeft :: Poly -> Vertex
Type declaration:

▸ (poly: Poly): Vertex

Parameters:

Name Type
poly Poly

Const getBottomRight

getBottomRight: function = nth(3)

Defined in Vertex/index.ts:399

getBottomRight :: Poly -> Vertex
Type declaration:

▸ (poly: Poly): Vertex

Parameters:

Name Type
poly Poly

Const getCornersFromPoly

getCornersFromPoly: function = applySpec({ start: head, end: last, })

Defined in Vertex/index.ts:241

getCornersFromPoly :: Poly -> Corners
Type declaration:

▸ (poly: Poly): Corners

Parameters:

Name Type
poly Poly

Const getTopLeft

getTopLeft: function = nth(0)

Defined in Vertex/index.ts:378

getTopLeft :: Poly -> Vertex
Type declaration:

▸ (poly: Poly): Vertex

Parameters:

Name Type
poly Poly

Const getTopRight

getTopRight: function = nth(1)

Defined in Vertex/index.ts:385

getTopRight :: Poly -> Vertex
Type declaration:

▸ (poly: Poly): Vertex

Parameters:

Name Type
poly Poly

Const getX

getX: function = pipe(head, prop<'x', number>('x'))

Defined in Vertex/index.ts:309

getX :: Line -> Int
Type declaration:

▸ (line: Line): number

Parameters:

Name Type
line Line

Const getXs

getXs: function = map(getX)

Defined in Vertex/index.ts:323

getXs :: [Line] -> [Int]
Type declaration:

▸ (lines: Line[]): number[]

Parameters:

Name Type
lines Line[]

Const getY

getY: function = pipe(head, prop<'y', number>('y'))

Defined in Vertex/index.ts:302

getY :: Line -> Int
Type declaration:

▸ (line: Line): number

Parameters:

Name Type
line Line

Const getYs

getYs: function = map(getY)

Defined in Vertex/index.ts:316

getYs :: [Line] -> [Int]
Type declaration:

▸ (lines: Line[]): number[]

Parameters:

Name Type
lines Line[]

Const heightOf

heightOf: function = converge(subtract, [ pipe(getBottomLeft, prop('y')), pipe(getTopLeft, prop('y')), ])

Defined in Vertex/index.ts:508

heightOf :: Poly -> Int
Type declaration:

▸ (poly: Poly): number

Parameters:

Name Type
poly Poly

Const widthOf

widthOf: function = converge(subtract, [ pipe(getTopRight, prop('x')), pipe(getTopLeft, prop('x')), ])

Defined in Vertex/index.ts:498

widthOf :: Poly -> Int
Type declaration:

▸ (poly: Poly): number

Parameters:

Name Type
poly Poly

Functions

Const append

append<**A**>(boundingBox: A): (Anonymous function)

Defined in Vertex/index.ts:361

append :: BoundingBox -> ([Int], [Int]) -> BoundingBox

Type parameters:

A: BoundingBox

Parameters:

Name Type
boundingBox A

Returns: (Anonymous function)


Const hasHeader

hasHeader<**A**>(a: A): a is WithHeader

Defined in Vertex/index.ts:149

hasHeader :: a -> bool

Type parameters:

A: BoundingBox

Parameters:

Name Type
a A

Returns: a is WithHeader


Const hasHeaderColumn

hasHeaderColumn<**A**>(a: A): a is WithHeaderColumn

Defined in Vertex/index.ts:140

hasHeaderColumn :: a -> bool

Type parameters:

A: BoundingBox

Parameters:

Name Type
a A

Returns: a is WithHeaderColumn


Const hasHeaderRow

hasHeaderRow<**A**>(a: A): a is WithHeaderRow

Defined in Vertex/index.ts:131

hasHeaderRow :: a -> bool

Type parameters:

A: BoundingBox

Parameters:

Name Type
a A

Returns: a is WithHeaderRow


Const isBoundingBox

isBoundingBox(a: unknown): a is BoundingBox

Defined in Vertex/index.ts:119

isBoundingBox :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is BoundingBox


Const isLabeledBoundingBox

isLabeledBoundingBox(a: unknown): a is LabeledBoundingBox

Defined in Vertex/index.ts:330

isLabeledBoundingBox :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is LabeledBoundingBox


Const isLine

isLine(a: unknown): a is Line

Defined in Vertex/index.ts:87

isLine :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is Line


Const isPoly

isPoly(a: unknown): a is Poly

Defined in Vertex/index.ts:99

isPoly :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is Poly


Const isVertex

isVertex(a: unknown): a is Vertex

Defined in Vertex/index.ts:79

isVertex :: a -> bool

Parameters:

Name Type
a unknown

Returns: a is Vertex


Const lengthOf

lengthOf(__namedParameters: [any, any]): number

Defined in Vertex/index.ts:518

lengthOf :: Line -> Int

Parameters:

Name Type
__namedParameters [any, any]

Returns: number


Const makeBoundingBox

makeBoundingBox(boundingPoly: Poly, ys: number[], xs: number[]): BoundingBox

Defined in Vertex/index.ts:283

makeBoundingBox :: (Poly, [Int], [Int]) -> BoundingBox

Parameters:

Name Type
boundingPoly Poly
ys number[]
xs number[]

Returns: BoundingBox


Const makeLabeledBoundingBox

makeLabeledBoundingBox(id: string, label: string, boundingPoly: Poly, ys: number[], xs: number[]): LabeledBoundingBox

Defined in Vertex/index.ts:338

makeLabeledBoundingBox :: (String, String, Poly, [Int], [Int]) -> LabeledBoundingBox

Parameters:

Name Type
id string
label string
boundingPoly Poly
ys number[]
xs number[]

Returns: LabeledBoundingBox


Const makeLine

makeLine(x0: number, y0: number, x1: number, y1: number): Line

Defined in Vertex/index.ts:164

makeVertex :: (Int, Int, Int, Int) -> Line

Parameters:

Name Type
x0 number
y0 number
x1 number
y1 number

Returns: Line


Const makePoly

makePoly(...coords: [number, number, number, number]): Poly

Defined in Vertex/index.ts:229

makePoly :: (Int, Int, Int, Int) -> Poly

Parameters:

Name Type
...coords [number, number, number, number]

Returns: Poly


Const makeVertex

makeVertex(x: number, y: number): Vertex

Defined in Vertex/index.ts:157

makeVertex :: (Int, Int) -> Vertex

Parameters:

Name Type
x number
y number

Returns: Vertex


Const withHeader

withHeader(vertex: Vertex): (Anonymous function)

Defined in Vertex/index.ts:483

withHeader :: Vertex -> ReaderEither BoundingBox (WithHeader BoundingBox) BoundingBox

Parameters:

Name Type
vertex Vertex

Returns: (Anonymous function)


Const withHeaderColumn

withHeaderColumn(x: number): (Anonymous function)

Defined in Vertex/index.ts:446

withHeaderColumn :: Int -> ReaderEither BoundingBox BoundingBox (WithHeaderColumn BoundingBox)

Parameters:

Name Type
x number

Returns: (Anonymous function)


Const withHeaderRow

withHeaderRow(y: number): (Anonymous function)

Defined in Vertex/index.ts:408

withHeaderRow :: Int -> ReaderEither BoundingBox BoundingBox (WithHeaderRow BoundingBox)

Parameters:

Name Type
y number

Returns: (Anonymous function)