Sha256: 94a60a8fb55086d40e06854865b2ccbb56253deca45587dac7bdf96cc80c4c56

Contents?: true

Size: 610 Bytes

Versions: 115

Compression:

Stored size: 610 Bytes

Contents

module.exports = getType

function getType (st) {
  var types = [
    'Directory',
    'File',
    'SymbolicLink',
    'Link', // special for hardlinks from tarballs
    'BlockDevice',
    'CharacterDevice',
    'FIFO',
    'Socket'
  ]
  var type

  if (st.type && types.indexOf(st.type) !== -1) {
    st[st.type] = true
    return st.type
  }

  for (var i = 0, l = types.length; i < l; i++) {
    type = types[i]
    var is = st[type] || st['is' + type]
    if (typeof is === 'function') is = is.call(st)
    if (is) {
      st[type] = true
      st.type = type
      return type
    }
  }

  return null
}

Version data entries

115 entries across 112 versions & 20 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/fstream/lib/get-type.js
disco_app-0.18.0 test/dummy/node_modules/fstream/lib/get-type.js
disco_app-0.18.2 test/dummy/node_modules/fstream/lib/get-type.js
tang-0.2.1 spec/tang_app/node_modules/fstream/lib/get-type.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/fstream/lib/get-type.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/fstream/lib/get-type.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/fstream/lib/get-type.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/fstream/lib/get-type.js
tang-0.2.0 spec/tang_app/node_modules/fstream/lib/get-type.js
tang-0.1.0 spec/tang_app/node_modules/fstream/lib/get-type.js
tang-0.0.9 spec/tang_app/node_modules/fstream/lib/get-type.js
enju_library-0.3.8 spec/dummy/node_modules/fstream/lib/get-type.js
ilog-0.4.1 node_modules/fstream/lib/get-type.js
ilog-0.4.0 node_modules/fstream/lib/get-type.js
ilog-0.3.3 node_modules/fstream/lib/get-type.js
jester-data-8.0.0 node_modules/fstream/lib/get-type.js
ezii-os-5.2.1 node_modules/fstream/lib/get-type.js
ezii-os-2.0.1 node_modules/fstream/lib/get-type.js
ezii-os-1.1.0 node_modules/fstream/lib/get-type.js
ezii-os-1.0.0 node_modules/fstream/lib/get-type.js