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

Issue #24: Add splitMapper + customisable options #50

Merged
merged 3 commits into from
Oct 17, 2020
Merged

Conversation

Siemienik
Copy link
Owner

Basic todo:

  • Create file src/mappers/splitMapper.ts with function matches to type (v: string): string[]. Which for any input try to return only lower case string.
  • reexport it in src/mappers/index.ts
  • Prove that it works in unit test (create new one in tests/unit/mappers.test.ts)
  • Describe it in Readme.md

Additionally done:

  • .separator(';'): SplitMapper - set separator
  • .itemMapper(itemMapper): SplitMapper - set mapper for items,

fully resolves: #24

…Add splitMapper itemMapper, Add tests+documentaion+samples
@codecov
Copy link

codecov bot commented Oct 17, 2020

Codecov Report

Merging #50 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #50   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        23    +2     
  Lines          311       351   +40     
  Branches         5         5           
=========================================
+ Hits           311       351   +40     
Impacted Files Coverage Δ
src/mappers/index.ts 100.00% <100.00%> (ø)
src/mappers/jsonMapper.ts 100.00% <100.00%> (ø)
src/mappers/splitMapper.ts 100.00% <100.00%> (ø)
tests/unit/mappers/splitMapper.test.ts 100.00% <100.00%> (ø)
tests/unit/mappers/stringMapper.test.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9969b70...855d198. Read the comment docs.

@Siemienik
Copy link
Owner Author

@Metastasis @Gontrum want you review?

Copy link

@Gontrum Gontrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, @Siemienik :-)
I only had two ideas. You can see if they make sense.

README.md Outdated
@@ -79,10 +81,14 @@ interface Person {
FirstName: string;
SecondName: string;
Age: number;

EmployedIn: string;
IsUnemployed:boolean;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one little thing for consistency: maybe you want to add a space here and in the next line.

This comment was marked as outdated.

Copy link
Owner Author

@Siemienik Siemienik Oct 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok see it, done in 971bc90. Good catch

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Metastasis @Gontrum want you review?

LGTM 👍

src/mappers/jsonMapper.ts Show resolved Hide resolved
['']
]

// building a mapper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an idea: Maybe you could add a function buildMapper() which returns the wordsInSentencesMapper, so you would not need the comment.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always prefer self-descriptive function than comments, however it is test case code and I wouldn’t make it more complicated. Wdyt?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's just a matter of taste and it always depends. I tend to always extract a method, if there is a comment.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 855d198

@Siemienik Siemienik merged commit 41a466a into master Oct 17, 2020
@Siemienik Siemienik deleted the issue-24 branch October 17, 2020 12:43
Siemienik added a commit that referenced this pull request Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add splitMapper into mappers
2 participants