UNPKG

@liferay/generator-js

Version:

Yeoman generators for Liferay DXP and Portal CE JavaScript projects.

36 lines (35 loc) 1.11 kB
/** * SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> * SPDX-License-Identifier: LGPL-3.0-or-later */ /** * A class to help modifying JSON files. */ export default class JsonModifier { /** * @param {Generator} generator a Yeoman generator * @param {String} path path to file * @param space the space string/number of spaces to use when stringifying */ constructor(generator: any, path: any, space?: string | number); /** * Get the JSON object associated to this modifier * @return {Object} a parsed JSON object */ get json(): object; /** * Modify an existing JSON file. * @param {Function} modifier the code that modifies the JSON (it receives a * single parameter with the JSON object) */ modifyJson(modifier: any): void; /** * Escape a property name to make it suitable for use in dot-prop * @param {string} name name of property * @return {string} the escaped name */ _escapeProp(name: any): string; private _generator; private _path; private _space; }