repos / neovimcraft

website that makes it easy to find neovim plugins
git clone https://github.com/neurosnap/neovimcraft.git

neovimcraft / src
Eric Bower · 11 Apr 23

entities.ts

 1import type { Plugin, Resource } from "./types.ts";
 2
 3export const createPlugin = (p: Partial<Plugin> = {}): Plugin => {
 4  return {
 5    type: "github",
 6    id: "",
 7    name: "",
 8    username: "",
 9    repo: "",
10    link: "",
11    tags: [],
12    homepage: "",
13    description: "",
14    branch: "main",
15    openIssues: 0,
16    watchers: 0,
17    forks: 0,
18    stars: 0,
19    subscribers: 0,
20    network: 0,
21    createdAt: "",
22    updatedAt: "",
23    ...p,
24  };
25};
26
27export function createResource(p: Partial<Resource> = {}): Resource {
28  return {
29    type: "github",
30    username: "",
31    repo: "",
32    tags: [],
33    ...p,
34  };
35}
36
37export const getResourceId = (d: { username: string; repo: string }) => {
38  return `${d.username}/${d.repo}`;
39};