Skip to content

Commit

Permalink
push build files [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jul 19, 2023
1 parent 809d6be commit b49b101
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 8 deletions.
1 change: 1 addition & 0 deletions lib/cjs/helpers/general.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export interface Path {
[subpath: string]: string | Path;
}
export declare function path<Subpaths extends Record<string, Path>>(_: string, subpaths?: Subpaths): Path & Subpaths;
export declare function snakeCaseToCamelCase(obj: Record<string, any>): void;
21 changes: 20 additions & 1 deletion lib/cjs/helpers/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.path = exports.wrap = exports.openInNewTab = void 0;
exports.snakeCaseToCamelCase = exports.path = exports.wrap = exports.openInNewTab = void 0;
function openInNewTab(url, target) {
if (target === void 0) { target = '_blank'; }
window.open(url, target);
Expand Down Expand Up @@ -64,3 +64,22 @@ subpaths) {
return path;
}
exports.path = path;
function snakeCaseToCamelCase(obj) {
Object.entries(obj).forEach(function (_a) {
var snakeKey = _a[0], value = _a[1];
if (typeof value === 'object')
snakeCaseToCamelCase(value);
var keys = snakeKey.split('_').filter(function (key) { return key !== ''; });
if (keys.length >= 1) {
var camelCaseKey = keys.reduce(function (previousValue, currentValue) {
return previousValue +
currentValue.charAt(0).toUpperCase() +
currentValue.slice(1);
});
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete obj[snakeKey];
obj[camelCaseKey] = value;
}
});
}
exports.snakeCaseToCamelCase = snakeCaseToCamelCase;
4 changes: 2 additions & 2 deletions lib/cjs/helpers/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { openInNewTab, wrap, path, Path } from './general';
import { openInNewTab, wrap, path, Path, snakeCaseToCamelCase } from './general';
import { insertDividerBetweenElements, getStyleOverrides, getClassNames, includesClassNames, matchClassNames } from './materialUI';
export { openInNewTab, wrap, path, type Path, insertDividerBetweenElements, getStyleOverrides, getClassNames, includesClassNames, matchClassNames };
export { openInNewTab, wrap, path, type Path, snakeCaseToCamelCase, insertDividerBetweenElements, getStyleOverrides, getClassNames, includesClassNames, matchClassNames };
3 changes: 2 additions & 1 deletion lib/cjs/helpers/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.matchClassNames = exports.includesClassNames = exports.getClassNames = exports.getStyleOverrides = exports.insertDividerBetweenElements = exports.path = exports.wrap = exports.openInNewTab = void 0;
exports.matchClassNames = exports.includesClassNames = exports.getClassNames = exports.getStyleOverrides = exports.insertDividerBetweenElements = exports.snakeCaseToCamelCase = exports.path = exports.wrap = exports.openInNewTab = void 0;
var general_1 = require("./general");
Object.defineProperty(exports, "openInNewTab", { enumerable: true, get: function () { return general_1.openInNewTab; } });
Object.defineProperty(exports, "wrap", { enumerable: true, get: function () { return general_1.wrap; } });
Object.defineProperty(exports, "path", { enumerable: true, get: function () { return general_1.path; } });
Object.defineProperty(exports, "snakeCaseToCamelCase", { enumerable: true, get: function () { return general_1.snakeCaseToCamelCase; } });
var materialUI_1 = require("./materialUI");
Object.defineProperty(exports, "insertDividerBetweenElements", { enumerable: true, get: function () { return materialUI_1.insertDividerBetweenElements; } });
Object.defineProperty(exports, "getStyleOverrides", { enumerable: true, get: function () { return materialUI_1.getStyleOverrides; } });
Expand Down
1 change: 1 addition & 0 deletions lib/esm/helpers/general.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export interface Path {
[subpath: string]: string | Path;
}
export declare function path<Subpaths extends Record<string, Path>>(_: string, subpaths?: Subpaths): Path & Subpaths;
export declare function snakeCaseToCamelCase(obj: Record<string, any>): void;
18 changes: 18 additions & 0 deletions lib/esm/helpers/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,21 @@ subpaths) {
}
return path;
}
export function snakeCaseToCamelCase(obj) {
Object.entries(obj).forEach(function (_a) {
var snakeKey = _a[0], value = _a[1];
if (typeof value === 'object')
snakeCaseToCamelCase(value);
var keys = snakeKey.split('_').filter(function (key) { return key !== ''; });
if (keys.length >= 1) {
var camelCaseKey = keys.reduce(function (previousValue, currentValue) {
return previousValue +
currentValue.charAt(0).toUpperCase() +
currentValue.slice(1);
});
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete obj[snakeKey];
obj[camelCaseKey] = value;
}
});
}
4 changes: 2 additions & 2 deletions lib/esm/helpers/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { openInNewTab, wrap, path, Path } from './general';
import { openInNewTab, wrap, path, Path, snakeCaseToCamelCase } from './general';
import { insertDividerBetweenElements, getStyleOverrides, getClassNames, includesClassNames, matchClassNames } from './materialUI';
export { openInNewTab, wrap, path, type Path, insertDividerBetweenElements, getStyleOverrides, getClassNames, includesClassNames, matchClassNames };
export { openInNewTab, wrap, path, type Path, snakeCaseToCamelCase, insertDividerBetweenElements, getStyleOverrides, getClassNames, includesClassNames, matchClassNames };
8 changes: 6 additions & 2 deletions lib/esm/helpers/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { openInNewTab, wrap, path } from './general';
import { openInNewTab, wrap, path, snakeCaseToCamelCase } from './general';
import { insertDividerBetweenElements, getStyleOverrides, getClassNames, includesClassNames, matchClassNames } from './materialUI';
// global
export { openInNewTab, wrap, path, insertDividerBetweenElements, getStyleOverrides, getClassNames, includesClassNames, matchClassNames };
export {
// general
openInNewTab, wrap, path, snakeCaseToCamelCase,
// materialUI
insertDividerBetweenElements, getStyleOverrides, getClassNames, includesClassNames, matchClassNames };

0 comments on commit b49b101

Please sign in to comment.