src/host/wscript.js

Maintainability

94.16

Lines of code

46

Created with Raphaël 2.1.002550751002019-3-122018-8-22018-5-92018-4-32018-2-282017-11-12017-6-72017-4-292017-3-22017-2-52016-12-3

2019-10-30
Maintainability: 94.16

Created with Raphaël 2.1.0012.52537.5502019-3-122018-8-22018-5-92018-4-32018-2-282017-11-12017-6-72017-4-292017-3-22017-2-52016-12-3

2019-10-30
Lines of Code: 46

Difficulty

4.73

Estimated Errors

0.07

Function weight

By Complexity

Created with Raphaël 2.1.0_gpfWScriptEcho1

By SLOC

Created with Raphaël 2.1.0_gpfWScriptEcho3
1
/**
2
 * @file MS Script host adapter
3
 * @since 0.1.5
4
 */
5
/*#ifndef(UMD)*/
6
"use strict";
7
/*global _GPF_HOST*/ // Host types
8
/*global _gpfConsoleGenerate*/ // Generate an object that can be used to simulate console methods
9
/*global _gpfDosPath:true*/ // DOS-like path
10
/*global _gpfExit:true*/ // Exit function
11
/*global _gpfHost*/ // Host type
12
/*global _gpfMainContext*/ // Main context object
13
/*global _gpfMsFSO:true*/ // Scripting.FileSystemObject activeX
14
/*#endif*/
15
 
16
/*jshint wsh: true*/
17
/*eslint-env wsh*/
18
/*eslint-disable new-cap*/
19
 
20
/**
21
 * @namespace gpf.wscript
22
 * @description Root namespace for WScript specifics
23
 * @since 0.1.9
24
 */
25
gpf.wscript = {};
26
 
27
/* istanbul ignore next */ // wscript.echo.1
28
function _gpfWScriptEcho (text) {
29
    WScript.Echo(text);
30
}
31
 
32
if (_GPF_HOST.WSCRIPT === _gpfHost) {
33
 
34
    _gpfDosPath = true;
35
 
36
    _gpfMsFSO = new ActiveXObject("Scripting.FileSystemObject");
37
 
38
    // Define console APIs
39
    _gpfMainContext.console = _gpfConsoleGenerate(_gpfWScriptEcho);
40
 
41
    /* istanbul ignore next */ // exit.1
42
    _gpfExit = function (code) {
43
        WScript.Quit(code);
44
    };
45
 
46
}