 require "./global"
 require "./function"
 
-isFunction = (f) -> typeof f == "function"
-isPlainArray = (o) -> o.constructor == Array
+{isFunction, isPlainArray, isExtendedClass} = require '../NeptuneLib/Types'
 
 NeptuneLib = null
 

  @getNamespaceNames: -> Object.keys(@namespaces).sort()
  @getModuleNames:    -> Object.keys(@modules).sort()

  @getNeptuneLib: -> NeptuneLib ||= require 'neptune-namespaces/NeptuneLib'

  @getInspectedObjects: (includeModules = true)->
    "#{@namespacePath}": @getNeptuneLib().merge

  @addModules: (map) ->
    for name, module of map
      @_setChildNamespaceProps name, module
      if isExtendedClass(module) && name != modName = module.getName()
        console.warn "NN: module name (#{name}) does not match module.exports.getName(): #{modName}"
      @modules[name] = @[name] = module unless name.match /^-/

    @
