Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce lodash #854

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Gruntfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const serverConfigs = {
server: serverConfig,
};

_.forEach(serverConfigs, (config) => {
for (const config of Object.values(serverConfigs)) {
config.optimization = {
minimizer: [
new TerserPlugin({
Expand All @@ -32,7 +32,7 @@ _.forEach(serverConfigs, (config) => {
}),
],
};
});
}

export = (grunt: typeof Grunt) => {
grunt.initConfig({
Expand Down Expand Up @@ -96,8 +96,8 @@ export = (grunt: typeof Grunt) => {
},

rename: (() => {
const renames: _.Dictionary<{ src: string; dest: string }> = {};
_.forEach(serverConfigs, (_config, task) => {
const renames: Record<string, { src: string; dest: string }> = {};
for (const task of Object.keys(serverConfigs)) {
renames[task] = {
src: 'out/pine.js',
dest: `out/pine-${task}-<%= grunt.option('version') %>.js`,
Expand All @@ -106,7 +106,7 @@ export = (grunt: typeof Grunt) => {
src: 'out/pine.js.map',
dest: `out/pine-${task}-<%= grunt.option('version') %>.js.map`,
};
});
}
return renames;
})(),

Expand Down
2 changes: 1 addition & 1 deletion src/sbvr-api/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ export const addPermissions = async (
request: ODataRequest & { permissionType?: PermissionCheck },
): Promise<void> => {
const { resourceName, odataQuery, odataBinds } = request;
const vocabulary = _.last(request.translateVersions)!;
const vocabulary = request.translateVersions.at(-1)!;
let abstractSqlModel = sbvrUtils.getAbstractSqlModel(request);

let { permissionType } = request;
Expand Down
10 changes: 5 additions & 5 deletions src/sbvr-api/sbvr-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ export const runRule = (() => {
}

let fetchingViolators = false;
const ruleAbs = _.last(abstractSqlModel.rules);
const ruleAbs = abstractSqlModel.rules.at(-1);
if (ruleAbs == null) {
throw new Error('Unable to generate rule');
}
Expand Down Expand Up @@ -1181,7 +1181,7 @@ const getFinalAbstractSqlModel = (
'translateVersions' | 'finalAbstractSqlModel'
>,
): AbstractSQLCompiler.AbstractSqlModel => {
const finalModel = _.last(request.translateVersions)!;
const finalModel = request.translateVersions.at(-1)!;
return (request.finalAbstractSqlModel ??= models[finalModel].abstractSql);
};

Expand Down Expand Up @@ -1906,7 +1906,7 @@ const runPost = async (
if (rowsAffected === 0) {
throw new PermissionError();
}
await validateModel(tx, _.last(request.translateVersions)!, request);
await validateModel(tx, request.translateVersions.at(-1)!, request);

return insertId;
};
Expand Down Expand Up @@ -1978,7 +1978,7 @@ const runPut = async (
({ rowsAffected } = await runQuery(tx, request, undefined, true));
}
if (rowsAffected > 0) {
await validateModel(tx, _.last(request.translateVersions)!, request);
await validateModel(tx, request.translateVersions.at(-1)!, request);
}
};

Expand Down Expand Up @@ -2008,7 +2008,7 @@ const runDelete = async (
): Promise<void> => {
const { rowsAffected } = await runQuery(tx, request, undefined, true);
if (rowsAffected > 0) {
await validateModel(tx, _.last(request.translateVersions)!, request);
await validateModel(tx, request.translateVersions.at(-1)!, request);
}
};

Expand Down
Loading