Skip to content

add new function 'getJSON' #1

Open
@liveangela

Description

@liveangela

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions