"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/fstream/lib/get-type.js" (8 Mar 2017, 610 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 module.exports = getType
    2 
    3 function getType (st) {
    4   var types = [
    5     'Directory',
    6     'File',
    7     'SymbolicLink',
    8     'Link', // special for hardlinks from tarballs
    9     'BlockDevice',
   10     'CharacterDevice',
   11     'FIFO',
   12     'Socket'
   13   ]
   14   var type
   15 
   16   if (st.type && types.indexOf(st.type) !== -1) {
   17     st[st.type] = true
   18     return st.type
   19   }
   20 
   21   for (var i = 0, l = types.length; i < l; i++) {
   22     type = types[i]
   23     var is = st[type] || st['is' + type]
   24     if (typeof is === 'function') is = is.call(st)
   25     if (is) {
   26       st[type] = true
   27       st.type = type
   28       return type
   29     }
   30   }
   31 
   32   return null
   33 }