Babel | ESLint | Flow | Jest | React | |
---|---|---|---|---|---|
Babel | |||||
ESLint | ✔️ | ||||
Flow | ✔️ | ✔️ | |||
Jest | ✔️ | ||||
React | ✔️ | ✔️ | ✔️ |
Babel | ESLint | Flow | Jest | React |
---|
export default createSubscriptionManager = () => { | |
const subs = [] | |
return { | |
subscriptions: subs, | |
interval: attachSubscriptionMethod(subs, interval), | |
listen: attachSubscriptionMethod(subs, listen), | |
timeout: attachSubscriptionMethod(subs, timeout), | |
promise: attachSubscriptionMethod(subs, promise), | |
import { GraphQLObjectType } from 'graphql'; | |
import { globalIdField } from 'graphql-relay'; | |
import { nodeInterface, defineNodeType } from './node'; | |
import { findById } from '../models/User'; | |
export const UserType = new GraphQLObjectType({ | |
name: 'User', | |
fields: { | |
id: globalIdField('User') |
const childProcess = require('child_process'); | |
function RelayCompilerPlugin(options) { | |
this.schema = options.schema; | |
this.src = options.src; | |
} | |
RelayCompilerPlugin.prototype.apply = function(compiler) { | |
const cmd = `relay-compiler --src ${this.src} --schema ${this.schema}`; |
export const closestToZero = input => { | |
if (!(Array.isArray(input) && input.length)) { | |
return 0; | |
} | |
return input.reduce((prev, value) => { | |
const ratio = Math.abs(prev / value); | |
if (ratio > 1 || (ratio === 1 && value > 0)) { | |
return value; |
export default (value, cb, path = '', res = {}, scannedValues=[]) => { | |
if (!value || typeof value !== 'object' || scannedValues.includes(value)) { | |
return res; | |
} | |
scannedValues.push(value); | |
if (Array.isArray(value)) { | |
value.forEach((next, index) => { | |
if (cb(next, index)) { |
Machine({ | |
id: 'JSON File', | |
initial: 'unknown', | |
context: { | |
path: null, | |
content: null, | |
}, | |
states: { | |
unknown: { | |
on: { |
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |