pages.js 333 Bytes
Newer Older
1 2
/* global _ */
/* eslint-disable no-unused-vars */
3

4 5 6 7 8 9 10 11
function makeSafePath (rawPath) {
  let rawParts = _.split(_.trim(rawPath), '/')
  rawParts = _.map(rawParts, (r) => {
    return _.kebabCase(_.deburr(_.trim(r)))
  })

  return _.join(_.filter(rawParts, (r) => { return !_.isEmpty(r) }), '/')
}
12 13

/* eslint-enable no-unused-vars */