Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/muhajirdev/related-pages
A simple utility to find related pages.
https://github.com/muhajirdev/related-pages
javascript related-pages typescript utility
Last synced: about 2 months ago
JSON representation
A simple utility to find related pages.
- Host: GitHub
- URL: https://github.com/muhajirdev/related-pages
- Owner: muhajirdev
- Created: 2019-06-16T04:56:00.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T17:58:59.000Z (about 1 year ago)
- Last Synced: 2023-12-15T19:21:52.095Z (about 1 year ago)
- Topics: javascript, related-pages, typescript, utility
- Language: TypeScript
- Size: 997 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Related Pages
![](https://user-images.githubusercontent.com/12745166/59559344-16afe680-902f-11e9-8640-088327623036.png)
## Getting Started
### Installation
```
yarn add related-pages
```or
```
npm install --save related-pages
```### Usage
```javascript
import { relatedPagesByTags } from "related-pages";// or if you're in nodejs environment
const { relatedPagesByTags } = require("related-pages");const pages = [
{
slug: "writing-an-article",
tags: ["write", "article", "document"]
},
{
slug: "how-to-write-unit-test",
tags: ["unit-test", "jest", "mocha", "tutorial"]
},
{
slug: "writing-article-about-jest",
tags: ["write", "jest"]
}
];const tags = ["mocha", "tutorial"];
const result = relatedPagesByTags(pages, tags);
console.log(result[0]);
// {
// slug: "how-to-write-unit-test",
// tags: ["unit-test", "jest", "mocha", "tutorial"]
// };
```The only required property is `tags` containing list of strings (`string[]`). Check the source code in `index.ts` to see the typings
## Test
```
yarn test
```## Author
Muhammad Muhajir [@muhajirdev](https://twitter.com/muhajirdev)
## License
MIT License