import *
syntax.
Here's an example where the contents of a file named "math_functions"
are imported into a file in the same directory:
import * as myMathModule from "math_functions";And breaking down that code:
myMathModule.add(2,3);
myMathModule.subtract(5,3);
import * as object_with_name_of_your_choice from "file_path_goes_here"You may use any name following the
object_with_name_of_your_choice.imported_function
import * as
portion of the statement. In order to utilize this method, it requires an object that receives the imported values (i.e., you must provide a name). From here, you will use the dot notation to call your imported values.
"capitalize_strings"
, that is in the same directory as the current file. Add the appropriate import *
statement to the top of the file, using the object provided.
import * as
syntax.
testString: assert(code.match(/import\s+\*\s+as\s+[a-zA-Z0-9_$]+\s+from\s*"\s*capitalize_strings\s*"\s*;/gi), 'Properly uses import * as
syntax.');
```