src/index.js
function getNamespace (path, relative) {
  // ignore parent path
  let final = ''
  if (relative) {
    const s = path.split('/')
    final = s[s.length - 1]
  } else {
    final = path.startsWith('./') ? path.slice(2) : path
  }
  // remove '.js'
  return final.slice(0, final.length - 3)
}
function getNamespace (path, relative) {
  // ignore parent path
  let final = ''
  if (relative) {
    const s = path.split('/')
    final = s[s.length - 1]
  } else {
    final = path.startsWith('./') ? path.slice(2) : path
  }
  // remove '.js'
  return final.slice(0, final.length - 3)
}
function getNamespace ( path , relative ) { // ignore parent path let final = '' if ( relative ) { const s = path . split ( '/' ) final = s [ s . length - 1 ] } else { final = path . startsWith ( './' ) ? path . slice ( 2 ) : path } // remove '.js' return final . slice ( 0 , final . length - 3 ) }
Get namespace from file path

@param {String} path  model file path such as 'test/sub/model.js'
@param {Boolean} relative  use relative namespace or not
Get namespace from file path