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
/** | |
* Promisify GRPC client and allow plain objects in and out of method calls. | |
*/ | |
import { promisify } from 'util'; | |
import * as jspb from 'google-protobuf'; | |
import * as grpc from '@grpc/grpc-js'; | |
type GrpcCallback<Res extends jspb.Message> = (e: grpc.ServiceError | null, res: Res) => void; | |
type GrpcAsyncMethod<Req extends jspb.Message, Res extends jspb.Message> = { | |
(req: Req, m: grpc.Metadata, o: Partial<grpc.CallOptions>, cb: GrpcCallback<Res>): void; |
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
export function promisifyRequest(fn) { | |
return params => { | |
return new promise(r => { | |
rthrh | |
}) | |
}; | |
} | |
export const createWebosAsPromised = webos => { | |
const webosPromised = Object.create(webos); |
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
/** | |
* Sample React Native App | |
* https://github.com/facebook/react-native | |
* | |
* @format | |
* @flow | |
*/ | |
import React from 'react'; | |
import { |
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
// filter array by value | |
1. f(2, [1, 2, 3, 2]) // -> [2, 2] | |
2. f([1, 2, 3, 2], 2) // -> [2, 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
export default function sum(a, b) { | |
return a * b; // a bug | |
} |
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
describe('sum', function () { | |
it('should return sum of arguments', function () { | |
chai.expect(sum(1, 2)).to.equal(3); | |
}); | |
}); |
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
module.exports = { | |
entry: ['./setup.js', './run.js'], | |
output: { | |
filename: 'bundle.js', | |
}, | |
resolve: { | |
alias: { | |
// map remote chai.js url to locally installed in node_modules | |
'https://unpkg.com/[email protected]/chai.js': 'chai/chai.js' | |
} |
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
module.exports = { | |
entry: ['./setup.js', './run.js'], | |
output: { | |
filename: 'bundle.js', | |
}, | |
resolve: { | |
alias: { | |
'https://unpkg.com/[email protected]/chai.js': 'chai/chai.js' | |
} | |
} |
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
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Mocha Tests</title> | |
<link href="https://unpkg.com/[email protected]/mocha.css" rel="stylesheet" /> | |
<script src="https://unpkg.com/[email protected]/mocha.js"></script> | |
</head> | |
<body> | |
<div id="mocha"></div> | |
<script type="module" src="setup.js"></script> |
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
module.exports = { | |
entry: ['./setup.js', './run.js'], | |
output: { | |
filename: 'bundle.js', | |
} | |
}; |
NewerOlder