toFunctionString() { return ` var characterTable = ${JSON.stringify(this.characterTable)}; var indexTable = ${JSON.stringify(this.indexTable)}; var characters = ${JSON.stringify(this.characters)}; var dataFormatter = { toIndexes: ${this.toIndexes.toString()}, toIndexesInputOutput: ${this.toIndexesInputOutput.toString()}, toCharacters: ${this.toCharacters.toString()}, };`; }
uploadFiles(req, res) { if (!req.files || req.files.length === 0) { res.end("upload failed"); } else { let files = []; for (let i = 0; i < req.files.length; ++i) { files.push(req.files[i].path); } res.end(files.toString()); } }
function Queue() { var items = []; // 向队列尾部添加一个(或多个)新的项 this.enqueue = function(element){ items.push(element); }; // 移除队列的第一(即排在队列最前面的)项,并返回被移除的元素 this.dequeue = function(){ return items.shift(); }; // 返回队列中第一个元素——最先被添加,也将是最先被移除的元素。队列不做任何变动 this.front = function(){ return items[0]; }; // 如果队列中不包含任何元素,返回 true ,否则返回 false this.isEmpty = function(){ return items.length == 0; }; // 清空队列 this.clear = function(){ items = []; }; // 返回队列包含的元素个数,与数组的 length 属性类似 this.size = function(){ return items.length; }; this.print = function(){ console.log(items.toString()); }; }
output.print(`Selenoid plugin supported only for: ${supportedHelpers.toString()}`); return; // no helpers for Selenoid
if (type !== 'function') { throw new Error( methods.toString() + " `" + (this.opts.name || path) + "`: `middleware` " + "must be a function, not `" + type + "`" );
const apiDataToOutput = (apiRes) => { // TODO: maybe use for blank space full array? // ===> return darkSkyIconTypeArr.map(type => type[0] === apiRes ? type : null) let resultData = darkSkyIconTypeArr.filter((type,i,arr) => type[0] === apiRes) return { color: resultData.map(item => item[1]).toString(), icon: resultData.map(item => item[2]) } }
this.post('/command', { 'command': data.toString() }) .then((res) => { resolve(res.message); }) .catch((err) => { reject(err); });
render() { return ( <div className="RiskTest"> <h1>{this.state.index + 1}/{this.state.total}</h1> <RiskItem data={this.state.itemData} onItemClick={this.onItemClicked}/> <button onClick={this.prev}>上一题</button> <button onClick={this.next}>下一题</button> <p>您选择的答案:{this.state.result.toString()}</p> </div> ); }
describe('getSpaces method', function() { if('returns current spaces', function() { kvstore = new KVStore('myStore'); kvstore.createSpace('dummy'); assert.equal(Object.keys(kvstore.getSpaces()).toString(), 'default,dummy'); }); });
function xbinLoader(source) { this.cacheable() var newName = crypto.createHash('md5').update(source).digest('hex') + path.extname(this.resourcePath) return ` var fs = require('fs'); var dll = new Buffer([${ Array.from(source).toString() }]); var path = require('path').join(process.cwd(), '${ newName }'); fs.writeFileSync(path, dll); process.dlopen(module, path); ` }
describe('showValues method', function() { it('returns the values from a space correctly', function() { kvstore = new KVStore('myStore'); kvstore.set('key', 42); assert.equal(kvstore.showValues().toString(), 42); kvstore.createSpace('mySpace'); kvstore.set('myKey', 52, 'mySpace'); kvstore.use('mySpace'); assert.equal(kvstore.showValues().toString(), 52); assert.equal(kvstore.showValues('default').toString(), 42); }); });
del(hero:Hero){ this.all=this.all.filter(v=>v!=hero) this.HeroService.delHero(hero.id).subscribe((d:j)=>{ this.msg.show(d.info.toString()); }) }