schematics-utilities icon indicating copy to clipboard operation
schematics-utilities copied to clipboard

add new function 'getJSON'

Open liveangela opened this issue 6 years ago • 1 comments

When trying to edit file '/tsconfig.json', there found no suitable functions. Considering add the follow function(from here):

export function getJSON(host: Tree, jsonFile: string, type?: string): any {
  if (!host.exists(jsonFile)) return null;

  const sourceText = host.read(jsonFile)!.toString('utf-8');
  const json = JSON.parse(sourceText);
  if (type && !json[type]) {
    json[type] = {};
  }
  return json;
}

Maybe it's should be classified as 'third-lib'

liveangela avatar Dec 19 '18 02:12 liveangela

HI,

Sorry for the very long wait. It sounds useful, would you like to implement it and open a PR?

nitayneeman avatar Aug 02 '19 06:08 nitayneeman