nodes: 0, module; 1, function_definition; 2, function_name:sort_js_files; 3, parameters; 4, block; 5, identifier:js_files; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:"""Sorts JavaScript files in `js_files`.
  
      It sorts JavaScript files in a given `js_files`
      into source files, mock files and spec files based on file extension.
  
      Output:
  
      * sources: source files for production.  The order of source files
        is significant and should be listed in the below order:
  
        - First, all the that defines the other application's angular module.
          Those files have extension of `.module.js`.  The order among them is
          not significant.
  
        - Followed by all other source code files.  The order among them
          is not significant.
  
      * mocks: mock files provide mock data/services for tests.  They have
        extension of `.mock.js`. The order among them is not significant.
  
      * specs: spec files for testing.  They have extension of `.spec.js`.
        The order among them is not significant.
  
      """; 14, assignment; 15, assignment; 16, assignment; 17, assignment; 18, assignment; 19, expression_list; 20, identifier:modules; 21, list_comprehension; 22, identifier:mocks; 23, list_comprehension; 24, identifier:specs; 25, list_comprehension; 26, identifier:other_sources; 27, list_comprehension; 28, identifier:sources; 29, binary_operator:modules + other_sources; 30, identifier:sources; 31, identifier:mocks; 32, identifier:specs; 33, identifier:f; 34, for_in_clause; 35, if_clause; 36, identifier:f; 37, for_in_clause; 38, if_clause; 39, identifier:f; 40, for_in_clause; 41, if_clause; 42, identifier:f; 43, for_in_clause; 44, if_clause; 45, identifier:modules; 46, identifier:other_sources; 47, identifier:f; 48, identifier:js_files; 49, call; 50, identifier:f; 51, identifier:js_files; 52, call; 53, identifier:f; 54, identifier:js_files; 55, call; 56, identifier:f; 57, identifier:js_files; 58, parenthesized_expression; 59, attribute; 60, argument_list; 61, attribute; 62, argument_list; 63, attribute; 64, argument_list; 65, boolean_operator; 66, identifier:f; 67, identifier:endswith; 68, identifier:MODULE_EXT; 69, identifier:f; 70, identifier:endswith; 71, identifier:MOCK_EXT; 72, identifier:f; 73, identifier:endswith; 74, identifier:SPEC_EXT; 75, boolean_operator; 76, not_operator; 77, not_operator; 78, not_operator; 79, call; 80, call; 81, call; 82, attribute; 83, argument_list; 84, attribute; 85, argument_list; 86, attribute; 87, argument_list; 88, identifier:f; 89, identifier:endswith; 90, identifier:SPEC_EXT; 91, identifier:f; 92, identifier:endswith; 93, identifier:MODULE_EXT; 94, identifier:f; 95, identifier:endswith; 96, identifier:MOCK_EXT
code: def sort_js_files(js_files):
      """Sorts JavaScript files in `js_files`.
  
      It sorts JavaScript files in a given `js_files`
      into source files, mock files and spec files based on file extension.
  
      Output:
  
      * sources: source files for production.  The order of source files
        is significant and should be listed in the below order:
  
        - First, all the that defines the other application's angular module.
          Those files have extension of `.module.js`.  The order among them is
          not significant.
  
        - Followed by all other source code files.  The order among them
          is not significant.
  
      * mocks: mock files provide mock data/services for tests.  They have
        extension of `.mock.js`. The order among them is not significant.
  
      * specs: spec files for testing.  They have extension of `.spec.js`.
        The order among them is not significant.
  
      """
      modules = [f for f in js_files if f.endswith(MODULE_EXT)]
      mocks = [f for f in js_files if f.endswith(MOCK_EXT)]
      specs = [f for f in js_files if f.endswith(SPEC_EXT)]
  
      other_sources = [f for f in js_files
                       if (not f.endswith(MODULE_EXT) and
                           not f.endswith(MOCK_EXT) and
                           not f.endswith(SPEC_EXT))]
  
      sources = modules + other_sources
      return sources, mocks, specs