mirror of
https://github.com/unraid/api.git
synced 2026-01-21 07:59:41 -06:00
24 lines
457 B
TypeScript
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
|
|
});
|
|
};
|