summaryrefslogtreecommitdiff
path: root/src/helpers/slug.js
blob: 5a8db08fdc8dd640f79269355197083ef5863065 (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
};