• Jump To … +
    Array.litcoffee Boolean.litcoffee Function.litcoffee Number.litcoffee Object.litcoffee String.litcoffee _register.js _to_map_and_write_Tests.litcoffee assert_Array.litcoffee assert_Boolean.litcoffee assert_Function.litcoffee assert_Number.litcoffee assert_Object.litcoffee assert_String.litcoffee console.litcoffee fs.litcoffee globals.litcoffee http.litcoffee index.md path.litcoffee process.litcoffee Array.test.coffee Boolean.test.coffee Function.test.coffee Number.test.coffee Object.test.coffee String.test.coffee Array.test.coffee Boolean.test.coffee Function.test.coffee Number.test.coffee Object.test.coffee String.test.coffee console.test.coffee fs.test.coffee globals.test.coffee http.test.coffee path.test.coffee process.test.coffee
  • globals.litcoffee

  • ¶

    global methods

    These are helper methods that are added to the global object, the main reason is that they can handle null values, where the normal prototypes are not able to detect that (in a controlled way)

    existy value

    confirms that a value exists (i.e. is not null or undefined)

    global.existy = (value)->
      value?
    
    global.not_Null = global.existy
  • ¶

    is_Null

    returns true if value is null

    global.is_Null = (value)->
      value is null
  • ¶

    file_Exists file

    Returns true if file exists

    global.file_Exists = (file)->
      if not_Null(file)
        file.file_Exists()
      else
        false
  • ¶

    using target,callback

    simulates a ‘using’ or ‘with’ language feaure where the this object (inside callback) is changed to value

    global.using = (target,callback)->
      callback.apply(target)
  • ¶

    truthly value

    Returns true if value exists and is not false

    global.truthly = (value)->
      value? and value != false
  • ¶

    log message

    Simple wrapper for console.log

    global.log   = console.log