Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _parseCommandLineOptions(options) {
for (var i = 0, iz = argv.length; i < iz; ++i) {
switch (argv[i]) {
case "-h":
case "--help": options.help = true; break;
case "-v":
case "--verbose": options.verbose = true; break;
case "--nowrap": options.nowrap = true; break;
case "--header": options.header = fs.readFileSync(argv[++i], "utf8"); break;
case "--footer": options.footer = fs.readFileSync(argv[++i], "utf8"); break;
case "--es5in": options.es5in = true; break;
case "--es6in": options.es6in = true; break;
case "--es5out": options.es5out = true; break;
case "--es6out": options.es6out = true; break;
case "--strict": break; // [DEPRECATED]
case "--keep": options.keep = true; break;
case "--simple": break; // [DEPRECATED]
case "--extern":
case "--externs": _pushif(options.externs, argv[++i]); break;
case "--option": _pushif(options.option, argv[++i]); break;
case "--pretty": options.pretty = true; break;
case "--optimize": _pushif(options.externs, argv[++i]); break;
case "--concat": options.optimize = 0;
options.include_modules = true; break;
case "--debug": options.optimize = 1;
const path = `node_modules/${packageName}/${name}.js`
const data = readFileSync(path, 'utf8')
writeFileSync(path, data.replace(src, dest))
}
// Fix versions in `react-native-sensitive-info` directly
const path_csproj = `node_modules/react-native-sensitive-info/windows/RNSensitiveInfo/RNSensitiveInfo/RNSensitiveInfo.csproj`
const data_csproj = readFileSync(path_csproj, 'utf8')
writeFileSync(path_csproj, data_csproj.replace('10.0.10586.0', '10.0.14393.0'))
const path_project = `node_modules/react-native-sensitive-info/windows/RNSensitiveInfo/RNSensitiveInfo/project.json`
const path_projectlock = `node_modules/react-native-sensitive-info/windows/RNSensitiveInfo/RNSensitiveInfo/project.lock.json`
const data_project = readFileSync(path_project, 'utf8')
writeFileSync(path_project, data_project.replace('"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",', '"Microsoft.NETCore.UniversalWindowsPlatform": "6.0.6",').replace("uap10.0","uap10.0.14393"))
unlinkSync(path_projectlock)
// Replace usage of `react-native-web` for `react-native-web_improved`
replace.call({
dest: 'react-native-web_improved',
packageName: 'babel-plugin-react-native-web',
src: 'react-native-web'
}, 'index')
const performBabelRequire = (filename: string) => {
workingParentFile = filename;
const { code } = require('@babel/core').transform(readFileSync(filename).toString(), {
filename,
...(getBabelPresetsAndPlugins()),
});
return requireFromString(code, filename);
// return requireFromString(code);
};
var Fhir = require('../fhir').Fhir;
var FhirPath = require('../fhirPath').FhirPath;
var fs = require('fs');
var assert = require('assert');
var _ = require('underscore');
var documentBundleJson = fs.readFileSync('./test/data/stu3/document-example-dischargesummary.json').toString();
var questionnaireResponseJson = fs.readFileSync('./test/data/r4/QuestionnaireResponse_01.json').toString();
describe('FhirPath', function() {
var resource = JSON.parse(documentBundleJson);
describe('parse', function() {
var fhirPath = new FhirPath(resource);
it('should parse a simple path', function() {
var parsed = fhirPath.parse('Bundle.entry.fullUrl');
assert(parsed);
assert(parsed.length === 1);
assert(parsed[0].path);
assert(parsed[0].path.length === 2);
assert(parsed[0].path[0] === 'entry');
assert(parsed[0].path[1] === 'fullUrl');
});
var fs = require('fs')
var os = require('os')
var path = require('path')
var child = require('child_process')
var ansimd = require('ansimd')
var compare = require('../../compare.js')
var spawn = child.spawn
if (os.type() === 'Windows_NT') spawn = require('win-spawn')
var gasketCmd = path.resolve(__dirname, '..', '..', 'node_modules', 'gasket', 'bin.js')
exports.problem = ansimd(fs.readFileSync(path.join(__dirname, 'problem.md')).toString())
exports.solution = "Reference solution:\n\n" + fs.readFileSync(path.join(__dirname, 'package.json')).toString() + '\n'
exports.verify = function(args, cb) {
var entry = spawnEntry(args)
var solution = spawnSolution()
compare(entry, solution, cb)
}
exports.run = function(args) {
var entry = spawnEntry(args)
console.error('gasket', 'run', '--config', path.resolve(args[0]))
entry.stdout.pipe(process.stdout)
entry.stderr.pipe(process.stderr)
}
function spawnEntry(args) {
var entryCmd = gasketCmd
exports.loadConfig = () => {
let configData = {};
try {
const configJSON = fs.readFileSync("config.json");
configData = JSON.parse(configJSON);
} catch (e) {
niod_console.error(e);
return;
}
for (const property of Object.keys(this.config)) {
if (configData.property) {
this.config[property] = configData[property];
}
}
niod_console.log("Config file loaded");
};
const templatePath = './helper_scripts/templates/interfaces/component.d.mustache';
const templateProps = { fileName, isClass, lowerFileName, isConnectStore };
const pageDirPath = `${exports.Config.pageInterfaceDir}/${fileName}.d.ts`;
const compDirPath = `${exports.Config.compInterfaceDir}/${fileName}.d.ts`;
const pageInterfaceIndex = './helper_scripts/templates/interfaces/page-index.d.mustache';
const compIntefaceIndex = './helper_scripts/templates/interfaces/component-index.d.mustache';
const storeInterface = './helper_scripts/templates/interfaces/redux-store.d.mustache';
const storeImportInterface = './helper_scripts/templates/interfaces/redux-import.d.mustache';
const writeFileProps = {
dirPath: isPage ? pageDirPath : compDirPath,
getFileContent: () => exports.Helper.getTemplate(templatePath, templateProps),
message: 'Added new interface file'
};
const replaceContentParams = {
fileDir: `${exports.Config.interfaceDir}/index.ts`,
filetoUpdate: fs.readFileSync(path.resolve('', `${exports.Config.interfaceDir}/index.ts`), 'utf8'),
getFileContent: () => exports.Helper.getTemplate(isPage ? pageInterfaceIndex : compIntefaceIndex, templateProps),
message: 'Interface file added to Interfaces/index.ts',
regexKey: isPage ? /...PAGE INTERFACES/g : /...COMPONENT INTERFACES/g
};
const replaceStoreParams = {
fileDir: `${exports.Config.reduxInterfaceDir}/Store.d.ts`,
filetoUpdate: fs.readFileSync(path.resolve('', `${exports.Config.reduxInterfaceDir}/Store.d.ts`), 'utf8'),
getFileContent: () => exports.Helper.getTemplate(storeInterface, templateProps),
message: 'Interface file added to Interfaces/Redux/Store.d.ts',
regexKey: /export type IStore\s[=]\s[{]/g
};
exports.Helper.writeFile(writeFileProps);
exports.Helper.replaceContent(replaceContentParams);
if (isConnectStore) {
exports.Helper.replaceContent(replaceStoreParams);
setTimeout(() => {
function oauthLazyHandshake (tokens, cb) {
const file = this.opts.file || CREDENTIALS_FILENAME
const fetchCredentials = setCredentials.call(this, cb)
if (!tokens && fs.existsSync(file)) {
tokens = JSON.parse(fs.readFileSync(file))
}
if (tokens && tokens.access_token) {
return fetchCredentials(null, tokens)
}
getAccessToken.call(this, fetchCredentials)
}
function stylePlayer() {
var theme = fs.readFileSync(path.join(__dirname, 'themes', 'theme.css'), "utf8");
mainWindow.webContents.insertCSS('#player paper-icon-button[data-id="show-miniplayer"] { display: none; }');
mainWindow.webContents.insertCSS(theme);
}
const fs = require('fs');
const present = require('present');
const targets = {
vanilla: { module: require('./vanilla'), source: fs.readFileSync('./vanilla/index.js').toString() },
vanillaPromote: { module: require('./vanilla-promote'), source: fs.readFileSync('./vanilla-promote/index.js').toString() },
ts: { module: require('./ts'), source: fs.readFileSync('./ts/index.js').toString() },
babel: { module: require('./es6/index-babel.js'), source: fs.readFileSync('./es6/index-babel.js').toString() },
buble: { module: require('./es6/index-buble.js'), source: fs.readFileSync('./es6/index-buble.js').toString() },
es6: { module: require('./es6/index.js'), source: fs.readFileSync('./es6/index.js').toString() },
};
const numLoops = 10;
let suites = [];
let executionTable = [];
let executionRow = [];
let memoryTable = [];
let memoryRow = [];
let previousMemory = null;
function addExecutionRow(elapsedTime) {
executionRow.push(elapsedTime.toFixed(2) + "ms");
let currentMemory = process.memoryUsage();