FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

function-linenums

v1.1.3 Public

function-linenums

function-linenums is a utility module for use with CFML exception TagContext arrays. Given a template and a line number it computes CFML function names - as tag context items do not include original CFML function names in them.

Installation

Install this module via CommandBox:

$ install funclinenums

Alternatively the git repository can be cloned into the desired directory.

ColdBox Module

You can leverage the module via the injection DSL: [email protected]:

property name="functionLineNums" inject="[email protected]";

Standalone Usage

Alternatively, the functionLineNumbers component can be instantiated directly:

functionLineNums = new funclinenums.functionLineNums();

Available methods

The following methods are available:

// pass in a TagContext item directly
functionName = functionLineNums.findTagContextFunction( tagContextItem );
// pass in a full path to a CFML source file and a line number
functionName = functionLineNums.findFunction( fullPath, lineNum );
// pass in a full path to a CFML source file
functionArray = functionLineNums.getFunctionRanges( fullPath );
/*
returns an array of structs:
[
    {
        "name": "funcName", 
        "start": 1, 
        "end": 104, 
        "startline": 1,
        "endline": 9
    }
]
*/
// pass in source code directly
functionArray = functionLineNums.walk( srcCode );
/*
returns an array of structs:
[
    {
        "name": "funcName", 
        "start": 1, 
        "end": 104, 
        "startline": 1,
        "endline": 9
    }
]
*/

Dependencies (0)


Dev Dependencies (1)


 

$ box install funclinenums

No collaborators yet.
     
  • Jul 13 2019 12:35 PM
  • Apr 22 2020 06:27 PM
  • 583
  • 0
  • 16,215