generated from Seekra/repository-template
style: remove unnecessary function whitespace
Remove the unnecessary whitespace between the function name or the 'function' keyword and the opening parenthesis.
This commit is contained in:
@@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
export const getSetting = function getSetting (name, settings) {
|
||||
export const getSetting = function getSetting(name, settings) {
|
||||
return settings.filter((setting) => setting.name === name)[0];
|
||||
};
|
||||
|
||||
export const getSettingRecursively = function getSettingRecursively (sectionPath, settings) {
|
||||
const oneSettingsLevel = function oneSettingsLevel (cursor, acc) {
|
||||
export const getSettingRecursively = function getSettingRecursively(sectionPath, settings) {
|
||||
const oneSettingsLevel = function oneSettingsLevel(cursor, acc) {
|
||||
const setting = getSetting(cursor[0], acc.content);
|
||||
if (!setting) return;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ limitations under the License.
|
||||
* @param {string} path - The settings page path.
|
||||
* @returns {Array} The settings page path segments.
|
||||
*/
|
||||
export const getSettingsPagePathSegments = function getSettingsPagePathSegments (path) {
|
||||
export const getSettingsPagePathSegments = function getSettingsPagePathSegments(path) {
|
||||
if (typeof path !== 'string') return [];
|
||||
return path
|
||||
.replace(/^\.+|\.+$/g, '')
|
||||
|
||||
@@ -16,13 +16,13 @@ limitations under the License.
|
||||
|
||||
const VALID_TYPES = ['bool', 'number', 'string', 'selection', 'section'];
|
||||
|
||||
export const assertString = function assertString (value, path) {
|
||||
export const assertString = function assertString(value, path) {
|
||||
if (typeof value !== 'string' || value.trim() === '') {
|
||||
throw new Error(`[settings] "${path}" must be a non-empty string`);
|
||||
}
|
||||
};
|
||||
|
||||
export const assertType = function assertType (value, path) {
|
||||
export const assertType = function assertType(value, path) {
|
||||
if (!VALID_TYPES.includes(value)) {
|
||||
throw new Error(
|
||||
`[settings] "${path}" has invalid type "${value}". Must be one of: ${VALID_TYPES.join(', ')}`
|
||||
@@ -30,7 +30,7 @@ export const assertType = function assertType (value, path) {
|
||||
}
|
||||
};
|
||||
|
||||
export const validateSelectionOptions = function validateSelectionOptions (options, path) {
|
||||
export const validateSelectionOptions = function validateSelectionOptions(options, path) {
|
||||
if (!Array.isArray(options) || options.length === 0) {
|
||||
throw new Error(`[settings] "${path}.options" must be a non-empty array`);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export const validateSelectionOptions = function validateSelectionOptions (optio
|
||||
});
|
||||
};
|
||||
|
||||
export const validateEntry = function validateEntry (entry, path) {
|
||||
export const validateEntry = function validateEntry(entry, path) {
|
||||
assertType(entry.type, `${path}.type`);
|
||||
|
||||
assertString(entry.name, `${path}.name`);
|
||||
@@ -98,7 +98,7 @@ export const validateEntry = function validateEntry (entry, path) {
|
||||
}
|
||||
};
|
||||
|
||||
export const validateFirstLevelSection = function validateFirstLevelSection (section, path) {
|
||||
export const validateFirstLevelSection = function validateFirstLevelSection(section, path) {
|
||||
assertString(section.name);
|
||||
assertString(section.i18n);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user