Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.

Commit e6e6f2f

Browse files
refactor: improved bundle size a bit
1 parent d64bd9c commit e6e6f2f

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

test/e2e/request.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import assert from 'assert';
22

3-
import _ from 'lodash';
3+
import isRegExp from 'lodash/isRegExp';
44
import request from 'request';
55

66
const requestData = Symbol('smart_request_data');
@@ -49,7 +49,7 @@ export class PromiseAssert extends Promise<any> implements RequestPromise {
4949
this,
5050
this.then(function(body) {
5151
try {
52-
if (_.isRegExp(expected)) {
52+
if (isRegExp(expected)) {
5353
assert(body.ok.match(expected), "'" + body.ok + "' doesn't match " + expected);
5454
} else {
5555
assert.equal(body.ok, expected);
@@ -73,7 +73,7 @@ export class PromiseAssert extends Promise<any> implements RequestPromise {
7373
this,
7474
this.then(function(body) {
7575
try {
76-
if (_.isRegExp(expected)) {
76+
if (isRegExp(expected)) {
7777
assert(body.error.match(expected), body.error + " doesn't match " + expected);
7878
} else {
7979
assert.equal(body.error, expected);

test/e2e/server.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import assert from 'assert';
22

3-
import _ from 'lodash';
3+
import isNil from 'lodash/isNil';
4+
import capitalize from 'lodash/capitalize';
5+
import isObject from 'lodash/isObject';
46
import { HTTP_STATUS, HEADERS, API_MESSAGE } from '@verdaccio/commons-api';
57

68
import smartRequest, { RequestPromise } from './request';
@@ -50,7 +52,7 @@ export interface ServerBridge {
5052
const TOKEN_BASIC = 'Basic';
5153

5254
function buildToken(type: string, token: string): string {
53-
return `${_.capitalize(type)} ${token}`;
55+
return `${capitalize(type)} ${token}`;
5456
}
5557

5658
const buildAuthHeader = (user, pass): string => {
@@ -81,7 +83,7 @@ export default class Server implements ServerBridge {
8183
method: options.method || 'GET',
8284
headers: headers,
8385
encoding: options.encoding,
84-
json: _.isNil(options.json) === false ? options.json : true,
86+
json: isNil(options.json) === false ? options.json : true,
8587
});
8688
}
8789

@@ -118,7 +120,7 @@ export default class Server implements ServerBridge {
118120
}
119121

120122
public putPackage(name: string, data) {
121-
if (_.isObject(data) && !Buffer.isBuffer(data)) {
123+
if (isObject(data) && !Buffer.isBuffer(data)) {
122124
data = JSON.stringify(data);
123125
}
124126

@@ -132,7 +134,7 @@ export default class Server implements ServerBridge {
132134
}
133135

134136
public putVersion(name: string, version: string, data: any) {
135-
if (_.isObject(data) && !Buffer.isBuffer(data)) {
137+
if (isObject(data) && !Buffer.isBuffer(data)) {
136138
data = JSON.stringify(data);
137139
}
138140

0 commit comments

Comments
 (0)