/** * Copyright (c) 2022 Amorphous * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import parseString from '@iarna/toml/parse-string' export const parseTOMLMeta = (tomlString: string): { [key: string]: any } => { try { const tomlObj = parseString(tomlString) return tomlObj } catch (err) { console.warn( "TOML parser failed. String is instead being saved as one unit in the '_unparsed' field, where it can be processed later", err ) return { _unparsed: tomlString, } } }