Skip to content

Commit 198bc7a

Browse files
authored
Add metadata fields to package.json and refactor in readme file (#10)
* feat: add metadata fields (description, keywords, author) to package.json * refactor: move basic usage section on top of getting started * feat: add install package guide * feat: add repository information abd issues page link
1 parent eb95a16 commit 198bc7a

File tree

2 files changed

+74
-47
lines changed

2 files changed

+74
-47
lines changed

README.md

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,59 @@
2727
- 📊 Similarity percentage calculation
2828
- 🔧 Easy to integrate
2929

30+
## Basic Usage 🚀
31+
32+
### Install the Package
33+
First, install the `text-compare` package using **npm or yarn**:
34+
35+
```bash
36+
npm install text-compare
37+
# or
38+
yarn add text-compare
39+
```
40+
After installing, here's a quick example to get you started:
41+
```js
42+
import { useTextComparison } from 'text-compare';
43+
44+
const TextDiffer = () => {
45+
const text1 = 'The quick brown fox jumps over the lazy dog';
46+
const text2 = 'The quick blue fox leaps over the happy dog';
47+
48+
const { comparisonResult, similarity } = useTextComparison(text1, text2);
49+
50+
return (
51+
<>
52+
<div className="flex gap-1 mb-4">{comparisonResult}</div>
53+
<div>Similarity: {similarity.toFixed(2)}%</div>
54+
</>
55+
);
56+
};
57+
```
58+
59+
## 🛠️ Advanced Usage
60+
61+
### Customization Options
62+
63+
The `useTextComparison` hook accepts an options object for customization:
64+
65+
```jsx
66+
const options = {
67+
customColors: {
68+
commonColor: '#1E90FF', // DodgerBlue for common words
69+
removedColor: '#FF6347', // TomatoRed for removed words
70+
addedColor: '#32CD32', // LimeGreen for added words
71+
}
72+
};
73+
74+
const { comparisonResult, similarity } = useTextComparison(text1, text2, options);
75+
```
76+
77+
### Available Options
78+
79+
| Option | Type | Description |
80+
|--------|---------|-------------|
81+
| `customColors` | object | An object containing color configurations for text highlighting. Properties: `commonColor` (for matching words), `removedColor` (for removed words), `addedColor` (for added words) |
82+
3083
## 🚀 Getting Started Guide
3184

3285
Follow the steps below to set up and work with the `text-compare` project.
@@ -92,53 +145,6 @@ npm run dev
92145
npm start
93146
```
94147

95-
## Basic Usage 🚀
96-
97-
Here's a quick example to get you started:
98-
99-
```js
100-
import { useTextComparison } from 'text-compare';
101-
102-
const TextDiffer = () => {
103-
const text1 = 'The quick brown fox jumps over the lazy dog';
104-
const text2 = 'The quick blue fox leaps over the happy dog';
105-
106-
const { comparisonResult, similarity } = useTextComparison(text1, text2);
107-
108-
return (
109-
<>
110-
<div className="flex gap-1 mb-4">{comparisonResult}</div>
111-
<div>Similarity: {similarity.toFixed(2)}%</div>
112-
</>
113-
);
114-
};
115-
```
116-
117-
## 🛠️ Advanced Usage
118-
119-
### Customization Options
120-
121-
The `useTextComparison` hook accepts an options object for customization:
122-
123-
```jsx
124-
const options = {
125-
customColors: {
126-
commonColor: '#1E90FF', // DodgerBlue for common words
127-
removedColor: '#FF6347', // TomatoRed for removed words
128-
addedColor: '#32CD32', // LimeGreen for added words
129-
}
130-
};
131-
132-
const { comparisonResult, similarity } = useTextComparison(text1, text2, options);
133-
```
134-
135-
### Available Options
136-
137-
| Option | Type | Description |
138-
|--------|---------|-------------|
139-
| `customColors` | object | An object containing color configurations for text highlighting. Properties: `commonColor` (for matching words), `removedColor` (for removed words), `addedColor` (for added words) |
140-
141-
142148
## Contributing 🤝
143149

144150
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/CreoWis/text-compare/issues).

package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
{
22
"name": "text-compare",
33
"version": "0.0.1",
4+
"description": "A tool for comparing text content efficiently.",
5+
"keywords": [
6+
"text",
7+
"comparison",
8+
"diff",
9+
"react",
10+
"typescript"
11+
],
12+
"author": {
13+
"name": "CreoWis",
14+
"email": "[email protected]",
15+
"url": "https://www.creowis.com/"
16+
},
17+
"repository": {
18+
"type": "git",
19+
"url": "https://github.com/CreoWis/text-compare"
20+
},
21+
"bugs": {
22+
"url": "https://github.com/CreoWis/text-compare/issues"
23+
},
24+
"license": "MIT",
425
"type": "module",
526
"main": "./dist/index.umd.js",
627
"module": "./dist/index.es.js",

0 commit comments

Comments
 (0)