This file contains hidden or 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 wait1 = (fn) => { | |
setTimeout(() => { | |
fn() | |
}, 100) | |
} | |
const wait2 = (fn) => { | |
setTimeout(() => { | |
fn() | |
}, 200) | |
} |
This file contains hidden or 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
db_.collection('service').remove({}, { | |
w: 1 | |
}, function(e) { | |
should.not.exists(e); | |
db_.collection('a').remove({}, { | |
w: 1 | |
}, function(e) { | |
should.not.exists(e); | |
db_.collection('b').remove({}, { | |
w: 1 |
This file contains hidden or 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 wait1 = (fn) => { | |
return new Promise(resolve => setTimeout(resolve, 100)) | |
} | |
const wait2 = (fn) => { | |
return new Promise(resolve => setTimeout(resolve, 200)) | |
} | |
const wait3 = (fn) => { | |
return new Promise(resolve => setTimeout(resolve, 300)) | |
} | |
wait1() |
This file contains hidden or 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
let auth = (user, pwd) => { | |
return new Promise((resolve, reject) => { | |
if( user !== "foo" && pwd !== "bar"){ | |
return reject({ message : "Wrond credential"}) | |
} | |
return resolve({ | |
user : user | |
}); | |
}); | |
} |
This file contains hidden or 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
export function componentDecorator() { | |
return function(target, key: string, descriptor: PropertyDescriptor) { | |
let fileName = Reflect.getMetadata(“fusebox: __filename”, target, key); | |
let dirName = Reflect.getMetadata(“fusebox: __dirname”, target, key); | |
let requireDeatils = Reflect.getMetadata(“fusebox: require”, target, key); // Local “require” function | |
let moduleDetails = Reflect.getMetadata(“fusebox: module”, target, key); | |
let exportsCollection = Reflect.getMetadata(“fusebox: exports”, target, key); | |
//load CSS by convention | |
let cssFileName = fileName.replace(`.js`, `.css`); | |
require(cssFileName); |
This file contains hidden or 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 { checkPassword } from "fuse-ts-raw-package" | |
// that package contains "import" statement which | |
// is nicely handled (split) by FuseBox | |
async function testMe(){ | |
const result = await checkPassword("123456"); | |
console.log(result); | |
} | |
testMe(); |
This file contains hidden or 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 { src, context, task } = require("fuse-box/sparky"); | |
context(class { | |
getConfig(){ | |
return FuseBox.init({ | |
homeDir : "src", | |
output : "dist/$name.js", | |
hash : this.production | |
}); | |
} | |
}); |
This file contains hidden or 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 { UserFile } from "../../../../server/UserFile"; | |
const request = require("request"); | |
const fs = require("fs"); | |
export interface CDNResponse { | |
name: string; | |
folder: string; | |
publicPath: string; å | |
} | |
export class Uploader { |
This file contains hidden or 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 { Context } from "./Context"; | |
import { CharTypes, CharType } from "./chars"; | |
import { OneCharToken } from "./OneCharToken"; | |
import { CharCategory } from "./CharCategory"; | |
import { TokenType } from "./TokenType"; | |
export interface ITokenizeProps { | |
str: string; | |
locations?: boolean; | |
onToken?: (token: any) => void; |
This file contains hidden or 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
export enum CharType { | |
Fill = 1, | |
ALPHABET = 1 << 2, | |
DIGIT = 1 << 3, | |
COLON = 1 << 4, // ":" | |
SEMICOLON = 1 << 5, // ";", | |
HYPHEN = 1 << 6, // "<" | |
NUMBER_SIGN = 1 << 7, | |
END_OF_LINE = 1 << 8, |