grunt.registerMultiTask("markdownlint", function task() { const done = this.async(); markdownlint( { "files": this.filesSrc }, function callback(err, result) { const resultString = err || ((result || "").toString()); if (resultString) { grunt.fail.warn("\n" + resultString + "\n"); } done(!err || !resultString); }); });
constructor( locator, prefixMessage = 'Element', postfixMessage = 'was not found by text|CSS|XPath', ) { if (typeof locator === 'object') { locator = JSON.stringify(locator); } throw new Error(`${prefixMessage} "${(new Locator(locator)).toString()}" ${postfixMessage}`); }
function updateName(name, value) { if (!value || typeof value !== 'string') { value = name; } else { value = value.trim().toString(0, 16); } properties.set(name, value); }
/** * @private * @description Generate a backup key * @example * const key = await generateBackupKey(); * @returns {Promise} Resolving with the key. */ async function generateBackupKey() { const apiKey = (await randomBytes(Math.ceil(BACKUP_KEY_LENGTH / 2))).toString('hex').slice(0, BACKUP_KEY_LENGTH); return apiKey; }
test('Issue #31 - nestedVarRedeclare : AST handling cpu', () => { const builder = new FunctionBuilder({ functionNodes: [new CPUFunctionNode(nestedVarRedeclareFunction.toString(), { output: [1] })], output: [1] }); assert.throws(() => { builder.getStringFromFunctionNames(['nestedVarRedeclareFunction']); }); });
let loadFile = (module, filename) => { let result = "", err; compiler.compile(fs.readFileSync(fileName), (e, code) => { err = e && e.cause ? e.cause : e; result = code && code.value ? code.value : code; }); if(err) { throw err; } return module._compile(result.toString(), filename); }
getAmendedFormData() { const formData = this.formRef.getFormData(); formData.interval = (formData.interval * formData.intervalMultiplier).toString(); delete formData.intervalMultiplier; return formData; }
constructor(path, { caseTo = 'lower' }) { super(...arguments); this.normaliseValue = a => a; if (caseTo && caseTo.toString().toLowerCase() === 'upper') { this.normaliseValue = a => a && a.toString().toUpperCase(); } else if (caseTo && caseTo.toString().toLowerCase() === 'lower') { this.normaliseValue = a => a && a.toString().toLowerCase(); } this.isOrderable = true; }
highlight(output = '') { let [first, ...rest] = (output.stack || output.toString()).split(EOL); return { formattedOutput: <ReplEntryOutputError message={first} trace={rest}> </ReplEntryOutputError>, error: true }; }
test('Automatic naming support webgl', () => { function hello_world() { return 42; } // Create a function hello node const node = new WebGLFunctionNode(hello_world.toString(), { output: [1] }); assert.notEqual(node, null, 'class creation check'); assert.equal(node.name, 'hello_world'); });
test('arrays referenced directly - Array(2) webgl', () => { const node = new WebGLFunctionNode((function refDirect() { const array = [0, 0]; return array; }).toString(), { returnType: 'Array(2)', output: [1] }); assert.equal(node.toString(), 'vec2 refDirect() {\n\ vec2 user_array=vec2(0.0, 0.0);\n\ return user_array;\n\ }'); });
test('arrays referenced directly - Array(2) cpu', () => { const node = new CPUFunctionNode((function refDirect() { const array = [0, 0]; return array; }).toString(), { returnType: 'Array(2)', output: [1] }); assert.equal(node.toString(), 'function refDirect() {\n\ const user_array=new Float32Array([0, 0]);\n\ return user_array;\n\ }'); });
test('arrays referenced indirectly - Array(4) cpu', () => { const node = new CPUFunctionNode((function indirect() { const array = [0, 0, 0, 0]; const array2 = array; return array2; }).toString(), { returnType: 'Array(4)', output: [1] }); assert.equal(node.toString(), 'function indirect() {\n\ const user_array=new Float32Array([0, 0, 0, 0]);\n\ const user_array2=user_array;\n\ return user_array2;\n\ }'); });