View Observable.ts
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 interface Subscription { | |
readonly closed: boolean; | |
unsubscribe: () => void; | |
} | |
export interface Observer<T> { | |
closed: boolean; | |
error: (error: any) => void; | |
complete: () => void; | |
next: (value: T) => void; |
View ts-workspaces-doctor.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
/* eslint-disable no-param-reassign */ | |
const { promises: fs, readFileSync } = require('fs'); | |
const path = require('path'); | |
const prettier = require('prettier'); | |
const { parse, stringify } = require('comment-json'); | |
const getWorkspaces = require('get-workspaces').default; | |
const findWorkspacesRoot = require('find-workspaces-root').default; | |
const safeRequire = m => { |
View useEventCallback.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
function useEventCallback(fn) { | |
const ref = useRef(fn) | |
useLayoutEffect(() => { | |
ref.current = fn; | |
}, [fn]); | |
return useCallback(() => { | |
const fn = ref.current; | |
return fn(); |
View createStore.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
import React, { useReducer, useContext, useMemo } from 'react' | |
import get from 'lodash/get' | |
import invariant from 'invariant' | |
const INIT = { | |
type: `INIT${Math.random() | |
.toString(36) | |
.substring(7) | |
.split('') | |
.join('.')}`, |
View styled components api resolver.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
const { utils } = require('react-docgen'); | |
const { default: resolveHOC } = require('react-docgen/dist/utils/resolveHOC'); | |
const { | |
default: resolveToModule, | |
} = require('react-docgen/dist/utils/resolveToModule'); | |
module.exports = ({ moduleName = 'styled-components' } = {}) => { | |
const isStyledExpression = (tagPath, t) => | |
(t.CallExpression.check(tagPath.node) && | |
tagPath.get('callee').node.name === 'styled') || |
View MainModulesPlugin.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
const concord = require('enhanced-resolve/lib/concord'); | |
const getInnerRequest = require('enhanced-resolve/lib/getInnerRequest'); | |
const createInnerCallback = require('enhanced-resolve/lib//createInnerCallback'); | |
const defaultConfig = { | |
'./lib/**': './src/**', | |
}; | |
function normalizeCondition(condition) { | |
let normalized = [].concat(condition); |
View FormExample.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
import React from 'react' | |
import Form from 'react-formal' | |
import { | |
Alert, | |
Button, | |
Col, ControlLabel, | |
Form as BsForm, FormControl, FormGroup as BsFormGroup, | |
HelpBlock, | |
} from 'react-bootstrap' |
View form.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
class Form extends React.Component { | |
constructor() { | |
super() | |
this.state = { | |
name: null | |
} | |
} | |
View ScrollSpy.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
import React, { PropTypes } from 'react'; | |
import { findDOMNode } from 'react-dom' | |
import getOffset from 'dom-helpers/query/offset'; | |
let ScrollSpy = React.createClass({ | |
childContextTypes: { | |
$scrollSpy: PropTypes.shape({ | |
anchor: PropTypes.func, | |
activeTarget: PropTypes.string | |
}) |
NewerOlder