Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Variables

Const mappedProperties

mappedProperties: { comma: string[]; pipe: string[]; space: string[] } = ...

the given property orderings for all possible file types

Type declaration

  • comma: string[]
  • pipe: string[]
  • space: string[]

Functions

determineFileRecordType

  • determineFileRecordType(fileString: string): string[]
  • looks at the contents of the file to determine what keys would be used to map the the values when the file is being parse. It looks for comma and pipe characters and default to space delimiters. Note: this works on the assumption that each file wont have delimiter characters of another file like "greg, | thomas"

    Parameters

    • fileString: string

      string from file contents used to determine mapped properties

    Returns string[]

filePathToString

  • filePathToString(path: string): Promise<string>
  • gets the contents of a file from the given path and turns it into a string. Note: this assumes small files sizes as the application would become much more complex when considering file piping for large files

    Parameters

    • path: string

    Returns Promise<string>

getPathsFromArgs

  • getPathsFromArgs(): string[]
  • get the file paths from the arguments given at the command line

    Returns string[]

getUsersFromInput

  • getUsersFromInput(): Promise<User[]>
  • This is a application specific function and is the only one meant to be used outside of testing. It works by

    1. getting the paths from the parameters
    2. taking each path and a) getting the string from the contents of the file b) getting order of the keys should be parsed in from the file type c) using results from both a and b to parse the file string into user models d) doing light validation on each user model

    Returns Promise<User[]>

    Promise<User[]>

parseInputFileToObjects

  • parseInputFileToObjects(propertiesToMapTo: string[], inputStr: string): User[]
  • takes a given delimited string and an array of mapping properties to parse out the user data

    Parameters

    • propertiesToMapTo: string[]

      array of properties that is mapped to parsed values

    • inputStr: string

      the string that is parsed for its values

    Returns User[]

Generated using TypeDoc