Skip to content

Commit

Permalink
fix: remove duplicate story source extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 15, 2020
1 parent fc742c9 commit 7b2d215
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions core/instrument/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,6 @@ const parseSource = async (
Object.keys(store.stories).forEach((key: string) => {
const story: Story = store.stories[key];
story.source = getASTSource(source, story.loc);
const { start, end } = story.loc || {};
if (start && end) {
const lines = source.split('\n');

if (start.line === end.line) {
story.source = lines[start.line - 1].substring(
start.column,
end.column,
);
} else {
const startLine = lines[start.line - 1];
const endLine = lines[end.line - 1];
if (startLine !== undefined && endLine !== undefined) {
story.source = [
startLine.substring(start.column),
...lines.slice(start.line, end.line - 1),
endLine.substring(0, end.column),
].join('\n');
}
}
}
});
return store;
};
Expand Down

0 comments on commit 7b2d215

Please sign in to comment.