suggestion
See original GitHub issueWould be nice if this had 0 dependencies:
import {readFileSync} from 'node:fs';
import {readFile} from 'node:fs/promises';
const parse = (uint8, options = {}) => {
// unlike buf.toString('utf8') or or readFile(path, 'utf8'), TextDecoder will remove BOM
let data = new TextDecoder().decode(uint8);
if (typeof options.beforeParse === 'function') {
data = options.beforeParse(data);
}
return JSON.parse(data, options.reviver);
};
export const loadJsonFile = (filePath, options) =>
readFile(filePath).then(data => parse(data, options));
export const loadJsonFileSync = (filePath, options) =>
parse(readFileSync(filePath), options);
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Suggestion Definition & Meaning - Merriam-Webster
a · the act or process of suggesting ; b · something (as a thought or plan) that is suggested.
Read more >SUGGESTION | definition in the Cambridge English Dictionary
an idea, possible plan, or action that is mentioned for other people to consider: [ C ] She made some helpful suggestions on...
Read more >Suggestion - Definition, Meaning & Synonyms - Vocabulary.com
A suggestion is an idea someone proposes. You can accept or reject a suggestion. When someone gives an order — like in the...
Read more >Suggestion Definition & Meaning - Dictionary.com
A suggestion is a proposal, piece of advice, or idea for consideration. Suggestion is the noun form the verb suggest. Suggestion is often...
Read more >Suggestion - Wikipedia
Suggestion is the psychological process by which a person guides their own or another person's desired thoughts, feelings, and behaviors by presenting ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I ended up dropping
parse-json
. Not worth the bloat.https://github.com/sindresorhus/load-json-file/releases/tag/v7.0.0
Thx