Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Remove dependency on lodash (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
rochdev authored and yurishkuro committed Apr 5, 2018
1 parent 3abef18 commit 3b8bd98
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"dependencies": {},
"devDependencies": {
"@types/chai": "3.4.35",
"@types/lodash": "4.14.61",
"@types/mocha": "2.2.40",
"@types/node": "7.0.12",
"chai": "^3.4.1",
Expand All @@ -43,7 +42,6 @@
"cross-env": "^4.0.0",
"istanbul": "^0.4.5",
"json-loader": "^0.5.4",
"lodash": "^4.17.4",
"mocha": "^2.4.5",
"shelljs": "^0.5.3",
"source-map-support": "^0.3.3",
Expand Down
8 changes: 5 additions & 3 deletions src/mock_tracer/mock_report.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
import * as _ from 'lodash';
import { DebugInfo, MockSpan } from './mock_span';

/**
Expand All @@ -22,15 +21,18 @@ export class MockReport {

this.unfinishedSpans = [];

_.each(spans, span => {
spans.forEach(span => {
if (span._finishMs === 0) {
this.unfinishedSpans.push(span);
}

this.spansByUUID[span.uuid()] = span;
this.debugSpans.push(span.debug());

_.each(span.tags(), (val, key: string) => {
const tags = span.tags();

Object.keys(tags).forEach((key: string) => {
const val = tags[key];
this.spansByTag[key] = this.spansByTag[key] || {};
this.spansByTag[key][val] = this.spansByTag[key][val] || [];
this.spansByTag[key][val].push(span);
Expand Down
3 changes: 1 addition & 2 deletions src/mock_tracer/mock_span.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */

import * as _ from 'lodash';
import * as opentracing from '../index';
import Reference from '../reference';
import MockContext from './mock_context';
Expand Down Expand Up @@ -115,7 +114,7 @@ export class MockSpan extends opentracing.Span {
operation : this._operationName,
millis : [this._finishMs - this._startMs, this._startMs, this._finishMs]
};
if (_.size(this._tags)) {
if (Object.keys(this._tags).length) {
obj.tags = this._tags;
}
return obj;
Expand Down

0 comments on commit 3b8bd98

Please sign in to comment.