1.0.4 • Published 5 years ago

related-pages v1.0.4

Weekly downloads
36
License
MIT
Repository
-
Last release
5 years ago

Related Pages

npm.io

Getting Started

Installation

yarn add related-pages

or

npm install --save related-pages

Usage

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

License

MIT License

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago