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

Example use for documentation #11

Merged
merged 3 commits into from
May 9, 2019
Merged

Conversation

whyboris
Copy link
Contributor

@whyboris whyboris commented May 8, 2019

I'm loving how useful and slim this package is ❤️

I thought minor documentation would be helpful 🙇

Copy link
Owner

@tad-lispy tad-lispy left a comment

Choose a reason for hiding this comment

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

Hey! Thank you very much. It's a change in a right direction. I'd like to suggest few improvements to your improvements... if I may say so 😉

Also, just like in #12, please update the changelog and take credit for your work.

It's alright if you have no time for this. If that's the case just let me know and I'll take care of it.

README.md Outdated
@@ -15,3 +15,28 @@ It provides a function that takes two string arguments and returns a hash like t
````

Please see [tests](./test/test.js) for more insights.
Copy link
Owner

Choose a reason for hiding this comment

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

I think it would make sense to move it below the example you provided.

README.md Outdated

### Example

Here is how you can use this package in an _Angular_ project:
Copy link
Owner

Choose a reason for hiding this comment

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

It seems to me that there is nothing specific to Angular in this example. Am I missing something?

Copy link
Owner

Choose a reason for hiding this comment

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

How about:

Install

npm install damerau-levenshtein

Use with ES6 modules

import * as levenshtien from 'damerau-levenshtein';

// ...

const lev = levenshtien('hello world', 'Hello World!');
// { steps: 4, relative: 0.3076923076923077, similarity: 0.6923076923076923 }

Use with TypeScript

interface LevenshteinResponse {
  steps: number;
  relative: number;
  similarity: number;
}

README.md Outdated

*Optional*

If you're using _TypeScript_, create an interface
Copy link
Owner

Choose a reason for hiding this comment

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

Would you please provide more complete example? How would I use this interface?

@whyboris
Copy link
Contributor Author

whyboris commented May 9, 2019

Thank you for detailed feedback. What do you think of this? 😄

Copy link
Owner

@tad-lispy tad-lispy left a comment

Choose a reason for hiding this comment

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

Good to go. Thanks!

@tad-lispy tad-lispy merged commit 5029d63 into tad-lispy:master May 9, 2019
@tad-lispy
Copy link
Owner

Hey, since you are using it with TypeScript, would you mind adding type annotations. If you do please make a separate PR and use the index.d.ts file. I'm mot using TypeScript so I'd prefer to stay with vanilla JS for the main module.

Of course only if you have time. You helped a lot already.

@whyboris
Copy link
Contributor Author

whyboris commented May 9, 2019

This will be a great learning experience -- I've been meaning to learn how all the .d.ts files work 😅

I'll look into it 👍

@whyboris whyboris deleted the documentation branch May 9, 2019 16:05
@tad-lispy
Copy link
Owner

I've published your stuff: https://www.npmjs.com/package/damerau-levenshtein/v/1.0.5

Thank you very much. I'm looking forward for the TS PR.

@whyboris whyboris mentioned this pull request May 13, 2019
@whyboris
Copy link
Contributor Author

Thank you for the suggestion, hope this works: #14

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.

2 participants