src/read/phantomjs.js

Maintainability

81.74

Lines of code

23

Created with Raphaël 2.1.002550751002019-3-122018-12-32018-8-22018-5-9

2019-10-30
Maintainability: 81.74

Created with Raphaël 2.1.007.51522.5302019-3-122018-12-32018-8-22018-5-9

2019-10-30
Lines of Code: 23

Difficulty

4.75

Estimated Errors

0.05

Function weight

By Complexity

Created with Raphaël 2.1.0_gpfReadPhantomJS1

By SLOC

Created with Raphaël 2.1.0_gpfReadPhantomJS10
1
/**
2
 * @file PhantomJS File system read implementation
3
 * @since 0.2.2
4
 */
5
/*#ifndef(UMD)*/
6
"use strict";
7
/*global _GPF_HOST*/ // Host types
8
/*global _gpfNodeFs*/ // Node/PhantomJS require("fs")
9
/*global _gpfReadSetImplIf*/ // Set the read implementation if the host matches
10
/*#endif*/
11
 
12
function _gpfReadPhantomJS (path) {
13
    return new Promise(function (resolve, reject) {
14
        try {
15
            resolve(_gpfNodeFs.read(path));
16
        } catch (e) {
17
            // Error is a string
18
            reject(new Error(e));
19
        }
20
    });
21
}
22
 
23
_gpfReadSetImplIf(_GPF_HOST.PHANTOMJS, _gpfReadPhantomJS);