setup eslint
This commit is contained in:
parent
22d0e023ee
commit
6cc24d2cbd
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
"extends": "airbnb-base"
|
||||
};
|
|
@ -1 +1,2 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
|
|
13
package.json
13
package.json
|
@ -1,11 +1,18 @@
|
|||
{
|
||||
"author": "Dotan Nahum",
|
||||
"dependencies": {
|
||||
"rxjs": "^5.0.0-beta.10",
|
||||
"lodash":"^3.10.0"
|
||||
"eslint-plugin-jsx-a11y": "5.1.1",
|
||||
"lodash": "^3.10.0",
|
||||
"rxjs": "^5.0.0-beta.10"
|
||||
},
|
||||
"description": "Snoopy is a profiling tool for React Native, that lets you snoop on the React Native Bridge.",
|
||||
"devDependencies": {},
|
||||
"devDependencies": {
|
||||
"eslint": "4.12.1",
|
||||
"eslint-config-airbnb": "15.1.0",
|
||||
"eslint-config-airbnb-base": "12.1.0",
|
||||
"eslint-plugin-import": "2.8.0",
|
||||
"eslint-plugin-jsx-a11y": "5.1.1"
|
||||
},
|
||||
"directories": {},
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
const normal = '▒';
|
||||
const crazy = '▇';
|
||||
export default (valuefn = ary => ary.length, threshold = 100, yellowbox = false) => events => events.do(
|
||||
infoAry => {
|
||||
const len = valuefn(infoAry);
|
||||
if (yellowbox && len >= threshold) {
|
||||
console.warn(`bars: event rate over threshold (${threshold}): ${len}`);
|
||||
}
|
||||
console.log('tick', (len >= threshold ?
|
||||
crazy
|
||||
: normal).repeat(Math.floor(Math.log(Math.max(len, 1)))) + `(${len})`);
|
||||
}
|
||||
);
|
||||
|
||||
export default (valuefn = ary => ary.length, threshold = 100, yellowbox = false) =>
|
||||
events => events.do((infoAry) => {
|
||||
const len = valuefn(infoAry);
|
||||
|
||||
const message = () => {
|
||||
const repeatTimes = Math.floor(Math.log(Math.max(len, 1)));
|
||||
|
||||
return (len <= threshold ? crazy : normal).repeat(repeatTimes);
|
||||
};
|
||||
|
||||
if (yellowbox && len >= threshold) {
|
||||
console.warn(`bars: event rate over threshold (${threshold}): ${len}`); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
console.log(`tick, ${message} ${len}`); // eslint-disable-line no-console
|
||||
});
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
|
||||
export default (time=1000)=>events=>events.bufferTime(time)
|
||||
|
||||
export default (time = 1000) => events => events.bufferTime(time);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import _ from 'lodash';
|
||||
import Log from '../log';
|
||||
|
||||
import _ from 'lodash'
|
||||
import Log from '../log'
|
||||
const log = new Log()
|
||||
const log = new Log();
|
||||
|
||||
export default (shape, output = false) => events => {
|
||||
export default (shape, output = false) => (events) => {
|
||||
const chain = events.filter(typeof shape === 'function' ? shape : _.matches(shape));
|
||||
return output ? chain.do(log.spy) : chain
|
||||
}
|
||||
|
||||
return output ? chain.do(log.spy) : chain;
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'rxjs/add/operator/do';
|
|||
import 'rxjs/add/operator/bufferTime';
|
||||
|
||||
class Stream {
|
||||
constructor (emitter) {
|
||||
constructor(emitter) {
|
||||
this.events = Observable.fromEvent(emitter, 'mqspy');
|
||||
this.spy = info => emitter.emit('mqspy', info);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue