Members | Descriptions |
---|---|
namespace assert |
Assertion test module, if testing result is false, you will get an error. The way of handling error can be set as continue or throw exception. |
namespace base32 |
base32 module with encode and decode operations. to use: |
namespace base64 |
base64 module with encode and decode operations. to use: |
namespace base64vlq |
base64vlq module with encode and decode operations. to use: |
namespace bson |
bson module with encode and decode operations. to use: |
namespace console |
console module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Session from "koa-session"; | |
import Router from "koa-router"; | |
import Koa from "koa"; | |
interface IContext { | |
dummy: string; | |
} | |
interface JContext { | |
dummy: number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package A | |
interface JContext { | |
j: string; | |
} | |
function fake1 (ctx: JContext) { | |
// type 2 | |
console.log(ctx); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline void ThrowError(const char* msg) | |
{ | |
Isolate* isolate = Isolate::current(); | |
// create custom error class/function | |
auto code = | |
"class MyError extends TypeError {" | |
"constructor(){" | |
"super();" | |
"this.name = 'MyError';" | |
"this.message = 'This is custom Error Object!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start(() => { | |
while(true) | |
{ | |
print("a"); | |
sleep(1000); | |
} | |
}) | |
while(true) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compose = require('koa-compose'); | |
const mids = []; | |
for (var i = 0; i < 20; i++) { | |
mids.push(async (context, next) => { | |
await next(); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const thunk = require('thunks')() | |
const co = require('co') | |
function * testPromise (i) { | |
return yield Promise.resolve(i) | |
} | |
async function testAsync (i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function check(n, fn, tm) { | |
var tm1 = tm || -1; | |
function _check() { | |
try { | |
if (fn()) return; | |
} catch (e) { | |
throw e; | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var structure = { | |
"root":{ | |
"name":"Main Level", | |
"god": "is a girl", | |
nodes:{ | |
"node1":{ | |
"name":"Node 1" | |
}, | |
"node2":{ | |
"name":"Node 2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mysql = require('mysql') | |
var env = process.env.NODE_ENV || 'development' | |
var config = require('../../config/config')[env] | |
var async = require('async'); | |
var kit = require("./kit"); | |
var logger = kit.getLogger(); | |
//create mysql connection | |
var connection = mysql.createConnection(config.mysql); |