Methods
deleteData(file, id)
Deletes a given entry in a given file.
Parameters:
| Name | Type | Description |
|---|---|---|
file |
string | The file which contains the data. |
id |
string | The id (timestamp) of the data we want to delete. |
- Source:
deletePath(path)
Deletes a given directory and all of its contents.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | The path to the directory which should be deleted. |
- Source:
exists(path) → {bool}
Checks whether a given path exists.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | The path to be checked. |
- Source:
Returns:
True if the path exists, else false.
- Type
- bool
getCurrentFilename() → {string}
Returns the name of the current file (with .json ending!).
- Source:
Returns:
The name of the current file (with .json ending!).
- Type
- string
getData(file, quest) → {array}
Filters data from a given file according to a given quest.
Parameters:
| Name | Type | Description |
|---|---|---|
file |
string | The file containing the data to be filtered. |
quest |
object | The quest for filtering the data. quest contains a connector (or/and) and an array of parameters to filter objects. Example: quest = { connector: 'or', params: [['type', 'earning'], ['budget', 'checking account']] } |
- Source:
Returns:
All the data which match the quest, in form of an array containing objects.
- Type
- array
getDataPath() → {string}
Returns the path to the folder containing the data.
- Source:
Returns:
The path to the folder containing the data.
- Type
- string
getJsonFiles() → {array}
Returns all json files which have data in it, sorted by their name (date).
- Source:
Returns:
Array of the file names of all json files with data in it (with .json ending!).
- Type
- array
readJsonFile(file) → {array}
Returns the content of an arbitrary json file.
Parameters:
| Name | Type | Description |
|---|---|---|
file |
string | The full path to the json file which we want to read. |
- Source:
Returns:
The contents of the file (as an array of objects). If the file does not
exist, an empty array will be returned.
- Type
- array
readMainStorage(field) → {string}
Reads a specified field in the mainStorage.json file.
Parameters:
| Name | Type | Description |
|---|---|---|
field |
string | The field we want to read. |
- Source:
Returns:
The corresponding value for the field.
- Type
- string
readPreference(pref) → {string}
Reads a field in the settings.json file.
Parameters:
| Name | Type | Description |
|---|---|---|
pref |
string | The name of the field we want to access. |
- Source:
Returns:
The corresponding value of the field.
- Type
- string
removeFile(file)
Removes a given file.
Parameters:
| Name | Type | Description |
|---|---|---|
file |
string | The name of the file to remove. |
- Source:
removeStats(obj)
After deleting an object, this function removes the object's influence on the statistics.
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object | The object which got deleted. |
- Source:
renamePath(oldPath, newPath)
Renames a given directory.
Parameters:
| Name | Type | Description |
|---|---|---|
oldPath |
string | The name of the directory to be renamed. |
newPath |
string | The new name for the directory. |
- Source:
replaceData(file, data)
Replaces a specific file with new data.
Parameters:
| Name | Type | Description |
|---|---|---|
file |
string | The file to override. |
data |
array | The data to write (in form of an array containing objects). |
- Source:
storeData(data)
Stores data in the appropriate data file. The file is determined by the date of the data.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
object | The data we want to store. |
- Source:
storePreference(name, value)
Saves a value in the settings.json file.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The name of the field we want to access. |
value |
any | The value we want to set for the corresponding field. |
- Source:
writeMainStorage(field, value)
Writes to mainStorage.json and sets a new value for the specified field.
Parameters:
| Name | Type | Description |
|---|---|---|
field |
string | The field which value we want to set. |
value |
any | The new value for the specified field. |
- Source: