https://github.com/devjiwonchoi/duplicheck
Retrieve duplicates from strings, numbers, arrays, or objects.
https://github.com/devjiwonchoi/duplicheck
duplicate duplicates
Last synced: 10 months ago
JSON representation
Retrieve duplicates from strings, numbers, arrays, or objects.
- Host: GitHub
- URL: https://github.com/devjiwonchoi/duplicheck
- Owner: devjiwonchoi
- License: mit
- Created: 2023-05-08T08:01:40.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-13T18:38:38.000Z (over 2 years ago)
- Last Synced: 2024-10-11T12:05:18.861Z (over 1 year ago)
- Topics: duplicate, duplicates
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/duplicheck
- Size: 85.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# duplicheck
Retrieve duplicates from strings, numbers, arrays, or objects.
## Installation
```bash
npm install duplicheck
```
## Real World Use Case
#### String
```ts
import dc from 'duplicheck'
const userAPI = getUserAPI() // 'https://example.com/api/v1/users'
const projectAPI = getProjectAPI() // 'https://example.com/api/v1/projects'
const baseAPI = dc(userAPI, projectAPI) // 'https://example.com/api/v1/'
```
#### Array
```ts
import dc from 'duplicheck'
const userArray = [
{ name: 'John Doe', age: 20 },
{ name: 'Jane Doe', age: 21 },
{ name: 'Jiwon Choi', age: 5 },
]
const authorizedUserArray = [
{ name: 'John Doe', age: 20 },
{ name: 'John Cena', age: 21 },
]
// Output: [{ name: 'John Doe', age: 20 }]
const validatedUserArray = dc(userArray, authorizedUserArray)
```
#### Object
```ts
import dc from 'duplicheck'
import { PageProps, LayoutProps } from './types'
// PageProps
// {
// path: string,
// children: React.ReactNode
// }
// LayoutProps
// {
// title: string,
// description: string,
// path: string,
// children: React.ReactNode
// }
const commonProps = dc(ButtonProps, InputProps)
// Output: { path: string, children: React.ReactNode }
```