]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/fstream/lib/get-type.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / fstream / lib / get-type.js
diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/fstream/lib/get-type.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/fstream/lib/get-type.js
new file mode 100644 (file)
index 0000000..19f6a65
--- /dev/null
@@ -0,0 +1,33 @@
+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
+}