From c9f8df54f8ccfc91c710659ed021d7d409fdf953 Mon Sep 17 00:00:00 2001 From: Carmine DiMascio Date: Sun, 29 Dec 2019 15:55:18 -0500 Subject: [PATCH] cleanup lodash deps --- package-lock.json | 13 ++++++++++++- package.json | 3 ++- src/framework/openapi.spec.loader.ts | 1 - src/index.ts | 4 ++-- src/middlewares/openapi.metadata.ts | 4 ++-- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 63cd0d4a..923a1bca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2433,7 +2433,8 @@ "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true }, "lodash.flattendeep": { "version": "4.4.0", @@ -2446,6 +2447,16 @@ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" + }, + "lodash.zipobject": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lodash.zipobject/-/lodash.zipobject-4.1.3.tgz", + "integrity": "sha1-s5n1q6j/YqdG9peb8gshT5ZNvvg=" + }, "log-driver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", diff --git a/package.json b/package.json index f02e10fc..9c23293f 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,9 @@ "content-type": "^1.0.4", "js-yaml": "^3.13.1", "json-schema-ref-parser": "^7.1.2", - "lodash": "^4.17.15", "lodash.merge": "^4.6.2", + "lodash.uniq": "^4.5.0", + "lodash.zipobject": "^4.1.3", "media-typer": "^1.1.0", "multer": "^1.4.2", "ono": "^6.0.0", diff --git a/src/framework/openapi.spec.loader.ts b/src/framework/openapi.spec.loader.ts index efbb6548..4010a6ee 100644 --- a/src/framework/openapi.spec.loader.ts +++ b/src/framework/openapi.spec.loader.ts @@ -1,4 +1,3 @@ -import * as _ from 'lodash'; import { OpenAPIFramework } from './index'; import { OpenAPIFrameworkAPIContext, diff --git a/src/index.ts b/src/index.ts index fbb2c185..d13d20b6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import ono from 'ono'; -import * as _ from 'lodash'; +import * as _uniq from 'lodash.uniq'; import * as middlewares from './middlewares'; import { Application, Response, NextFunction } from 'express'; import { OpenApiContext } from './framework/openapi.context'; @@ -108,7 +108,7 @@ export class OpenApiValidator { } // install param on routes with paths - for (const p of _.uniq(pathParams)) { + for (const p of _uniq(pathParams)) { app.param( p, ( diff --git a/src/middlewares/openapi.metadata.ts b/src/middlewares/openapi.metadata.ts index 2932831b..a547fb7d 100644 --- a/src/middlewares/openapi.metadata.ts +++ b/src/middlewares/openapi.metadata.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import * as _zipObject from 'lodash.zipobject'; import { pathToRegexp } from 'path-to-regexp'; import { Response, NextFunction } from 'express'; import { OpenApiContext } from '../framework/openapi.context'; @@ -50,7 +50,7 @@ export function applyOpenApiMetadata( if (matchedRoute) { const paramKeys = keys.map(k => k.name); const paramsVals = matchedRoute.slice(1); - const pathParams = _.zipObject(paramKeys, paramsVals); + const pathParams = _zipObject(paramKeys, paramsVals); return { schema,