summaryrefslogtreecommitdiff
path: root/src/helpers/slug.js
blob: ed1a5b6a2d008d0fb61dc269f9146c3060425f51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const createSlug = (name, id) => {
  return name?.trim().replace(new RegExp(/[^A-Za-z0-9]/, 'g'), '-').toLowerCase() + '-' + id;
}

const getId = (slug) => {
  let id = slug.split('-');
  return id[id.length-1];
}

export {
  createSlug,
  getId
};