Files
api/app/core/utils/misc/load-state.ts
Alexis Tyler 4e1b0bd72c chore: lint
2021-01-28 15:45:14 +10:30

24 lines
457 B
TypeScript

/*!
* Copyright 2019-2020 Lime Technology Inc. All rights reserved.
* Written by: Alexis Tyler
*/
import camelCaseKeys from 'camelcase-keys';
import { parseConfig } from './parse-config';
/**
* Loads state from path.
* @param filePath Path to state file.
*/
export const loadState = <T>(filePath: string): T => {
const config = parseConfig({
filePath,
type: 'ini'
});
// @ts-expect-error
return camelCaseKeys(config, {
deep: true
});
};