type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
MethodDeclaration | /**
* Return the sequelize connection directly
*/
public connection(): Sequelize.Sequelize {
return this.db;
} | GabrieleNunez/job-process | src/drivers/database.ts | TypeScript |
MethodDeclaration | /**
* From what has been initialized already, pull the model from the database object
* This can work across multiple modules at runtime
* @param modelName The name of the model specified by the factory
*/
public model<T1 extends typeof Sequelize.Model>(modelName: string): T1 {
if (typeof th... | GabrieleNunez/job-process | src/drivers/database.ts | TypeScript |
MethodDeclaration | /**
* Release the connection and free up resources
*/
public dispose(): Promise<void> {
return new Promise((resolve): void => {
this.db.close().then((): void => {
resolve();
});
});
} | GabrieleNunez/job-process | src/drivers/database.ts | TypeScript |
ArrowFunction |
(t: TFunction, props: SimpleInputProps) => {
let label = props.label;
if (typeof props.label === 'string') {
label = t(props.label);
}
let helperTextInvalid = props.helperTextInvalid;
if (typeof props.helperTextInvalid === 'string') {
helperTextInvalid = t(props.helperTextInvalid);
}
return {
... | ddonahue007/koku-ui | src/pages/costModels/components/inputs/simpleInput.tsx | TypeScript |
ArrowFunction |
props => {
const { t } = useTranslation();
const {
onChange,
value,
id,
label,
style,
helperTextInvalid,
validated,
onBlur,
isRequired,
placeholder,
} = translateSimpleInputProps(t, props);
return (
<FormGroup
isRequired={isRequired}
style={style}
f... | ddonahue007/koku-ui | src/pages/costModels/components/inputs/simpleInput.tsx | TypeScript |
TypeAliasDeclaration |
type SimpleInputFormGroupProps = Pick<
FormGroupProps,
'label' | 'style' | 'helperTextInvalid' | 'validated' | 'onBlur' | 'isRequired' | 'placeholder'
>; | ddonahue007/koku-ui | src/pages/costModels/components/inputs/simpleInput.tsx | TypeScript |
TypeAliasDeclaration |
type SimpleInputTextInputProps = Pick<TextInputProps, 'value' | 'onChange' | 'id'>; | ddonahue007/koku-ui | src/pages/costModels/components/inputs/simpleInput.tsx | TypeScript |
TypeAliasDeclaration |
type SimpleInputProps = SimpleInputTextInputProps & SimpleInputFormGroupProps; | ddonahue007/koku-ui | src/pages/costModels/components/inputs/simpleInput.tsx | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-notification-details',
templateUrl: './notification-details.component.html',
styleUrls: ['./notification-details.component.css']
})
export class NotificationDetailsComponent implements OnInit {
constructor() { }
ngOnInit() {
}
} | sliwalker/RouterExample | src/app/app-body/notification-details/notification-details.component.ts | TypeScript |
FunctionDeclaration |
export function computeGaussianDensity(position: PositionData, box: Box3D, radius: (index: number) => number, props: GaussianDensityProps) {
return Task.create('Gaussian Density', async ctx => {
return await GaussianDensityCPU(ctx, position, box, radius, props);
});
} | JeremyWesthead/molstar | src/mol-math/geometry/gaussian-density.ts | TypeScript |
FunctionDeclaration |
export function computeGaussianDensityTexture(position: PositionData, box: Box3D, radius: (index: number) => number, props: GaussianDensityProps, webgl: WebGLContext, texture?: Texture) {
return _computeGaussianDensityTexture(webgl.isWebGL2 ? '3d' : '2d', position, box, radius, props, webgl, texture);
} | JeremyWesthead/molstar | src/mol-math/geometry/gaussian-density.ts | TypeScript |
FunctionDeclaration |
export function computeGaussianDensityTexture2d(position: PositionData, box: Box3D, radius: (index: number) => number, props: GaussianDensityProps, webgl: WebGLContext, texture?: Texture) {
return _computeGaussianDensityTexture('2d', position, box, radius, props, webgl, texture);
} | JeremyWesthead/molstar | src/mol-math/geometry/gaussian-density.ts | TypeScript |
FunctionDeclaration |
export function computeGaussianDensityTexture3d(position: PositionData, box: Box3D, radius: (index: number) => number, props: GaussianDensityProps, webgl: WebGLContext, texture?: Texture) {
return _computeGaussianDensityTexture('2d', position, box, radius, props, webgl, texture);
} | JeremyWesthead/molstar | src/mol-math/geometry/gaussian-density.ts | TypeScript |
FunctionDeclaration |
function _computeGaussianDensityTexture(type: '2d' | '3d', position: PositionData, box: Box3D, radius: (index: number) => number, props: GaussianDensityProps, webgl: WebGLContext, texture?: Texture) {
return Task.create('Gaussian Density', async ctx => {
return type === '2d' ?
GaussianDensityTe... | JeremyWesthead/molstar | src/mol-math/geometry/gaussian-density.ts | TypeScript |
ArrowFunction |
async ctx => {
return await GaussianDensityCPU(ctx, position, box, radius, props);
} | JeremyWesthead/molstar | src/mol-math/geometry/gaussian-density.ts | TypeScript |
ArrowFunction |
async ctx => {
return type === '2d' ?
GaussianDensityTexture2d(webgl, position, box, radius, false, props, texture) :
GaussianDensityTexture3d(webgl, position, box, radius, props, texture);
} | JeremyWesthead/molstar | src/mol-math/geometry/gaussian-density.ts | TypeScript |
TypeAliasDeclaration |
export type GaussianDensityProps = typeof DefaultGaussianDensityProps | JeremyWesthead/molstar | src/mol-math/geometry/gaussian-density.ts | TypeScript |
TypeAliasDeclaration |
export type GaussianDensityData = {
radiusFactor: number
resolution: number
} & DensityData | JeremyWesthead/molstar | src/mol-math/geometry/gaussian-density.ts | TypeScript |
TypeAliasDeclaration |
export type GaussianDensityTextureData = {
radiusFactor: number
resolution: number
} & DensityTextureData | JeremyWesthead/molstar | src/mol-math/geometry/gaussian-density.ts | TypeScript |
FunctionDeclaration |
export function getInvitationVerificationFeeInDollars() {
const inviteFee = features.ESCROW_WITHOUT_CODE ? 0 : INVITE_FEE
return new BigNumber(inviteFee)
} | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
FunctionDeclaration |
export function getInvitationVerificationFeeInWei() {
const inviteFee = features.ESCROW_WITHOUT_CODE ? 0 : INVITE_FEE
return new BigNumber(inviteFee).multipliedBy(1e18)
} | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
FunctionDeclaration |
export async function generateInviteLink(inviteCode?: string) {
let bundleId = DeviceInfo.getBundleId()
bundleId = bundleId.replace(/\.(debug|dev)$/g, '.alfajores')
// trying to fetch appStoreId needed to build a dynamic link
const shortUrl = await generateShortInviteLink({
link: `https://valoraapp.com/${... | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
FunctionDeclaration |
export function* sendInvite(
e164Number: string,
inviteMode: InviteBy,
amount?: BigNumber,
currency?: CURRENCY_ENUM
) {
const escrowIncluded = !!amount
try {
ValoraAnalytics.track(
features.KOMENCI ? InviteEvents.invite_start : InviteEvents.invite_tx_start,
{ escrowIncluded, amount: amount... | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
FunctionDeclaration |
export function* initiateEscrowTransfer(
e164Number: string,
amount: BigNumber,
temporaryAddress?: string
) {
const context = newTransactionContext(TAG, 'Escrow funds')
try {
const phoneHashDetails = yield call(fetchPhoneHashPrivate, e164Number)
yield put(transferEscrowedPayment(phoneHashDetails, amo... | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
FunctionDeclaration | // TODO: Delete this if we don't decide to use it again
// function* navigateToInviteMessageApp(e164Number: string, inviteMode: InviteBy, message: string) {
// try {
// switch (inviteMode) {
// case InviteBy.SMS: {
// ValoraAnalytics.track(InviteEvents.invite_method_sms)
// yield call(sendSm... | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
FunctionDeclaration |
export function* redeemInviteSaga({ tempAccountPrivateKey }: RedeemInviteAction) {
yield call(waitWeb3LastBlock)
Logger.debug(TAG, 'Starting Redeem Invite')
const {
result,
cancel,
timeout,
}: {
result: { success: true; newAccount: string } | { success: false } | undefined
cancel: TakeEffe... | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
FunctionDeclaration |
export function* doRedeemInvite(tempAccountPrivateKey: string) {
try {
ValoraAnalytics.track(OnboardingEvents.invite_redeem_start)
const tempAccount = privateKeyToAddress(tempAccountPrivateKey)
Logger.debug(TAG + '@doRedeemInvite', 'Invite code contains temp account', tempAccount)
const [tempAccount... | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
FunctionDeclaration |
function* addTempAccountToWallet(tempAccountPrivateKey: string) {
Logger.debug(TAG + '@addTempAccountToWallet', 'Attempting to add temp wallet')
try {
// Import account into the local geth node
const wallet: UnlockableWallet = yield call(getWallet)
const account = privateKeyToAddress(tempAccountPrivate... | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
FunctionDeclaration |
export function* moveAllFundsFromAccount(
account: string,
accountBalanceWei: BigNumber,
toAccount: string,
currency: CURRENCY_ENUM,
comment: string
) {
Logger.debug(TAG + '@moveAllFundsFromAccount', 'Unlocking account')
const wallet: UnlockableWallet = yield call(getWallet)
const password: string = yi... | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
FunctionDeclaration |
export function* inviteSaga() {
yield spawn(watchSendInvite)
yield spawn(watchRedeemInvite)
} | critesjosh/celo-monorepo | packages/mobile/src/invite/saga.ts | TypeScript |
ArrowFunction |
({ posts }: Props): TagObj => {
const taggedPosts = (posts ?? []).filter((post) => post.tags);
const tags = [...taggedPosts.map((p) => p?.tags).flat()].filter(nonNullable);
const tagObj: TagObj = {};
tags.forEach((tag) => {
if (tag in tagObj) {
tagObj[tag]++;
} else {
tagObj[tag] = 1;
}... | pickyzz/pickyzz.ga | lib/notion/getAllTags.ts | TypeScript |
ArrowFunction |
(post) => post.tags | pickyzz/pickyzz.ga | lib/notion/getAllTags.ts | TypeScript |
ArrowFunction |
(p) => p?.tags | pickyzz/pickyzz.ga | lib/notion/getAllTags.ts | TypeScript |
ArrowFunction |
(tag) => {
if (tag in tagObj) {
tagObj[tag]++;
} else {
tagObj[tag] = 1;
}
} | pickyzz/pickyzz.ga | lib/notion/getAllTags.ts | TypeScript |
TypeAliasDeclaration |
type Props = {
posts: Post[];
}; | pickyzz/pickyzz.ga | lib/notion/getAllTags.ts | TypeScript |
ClassDeclaration |
@Module({
imports: [UsuarioModule],
controllers: [],
providers: [
{
provide: APP_FILTER,
useClass: FiltroDeExcecaoHttp
},
{
provide: APP_INTERCEPTOR,
useClass: ClassSerializerInterceptor
},
{
provide: APP_INTERCEPTOR,
useClass: TransformaRespostaInterceptor... | RafaelCava/nest_estudo_2 | src/app.module.ts | TypeScript |
ArrowFunction |
() => {
const listData = [
{
id: 1,
icon: BgImg,
title: '蚂蚁森林 开启绿色生活',
introduce: '壹贰叁肆伍陆柒捌玖拾壹贰叁肆伍陆柒壹贰叁肆伍陆柒捌玖拾壹贰...',
},
{
id: 2,
icon: BgImg,
title: '城市服务 到账快更实惠',
introduce: '手握医保神器,却不',
},
{
id: 3,
icon: BgImg,
title: '蚂蚁森林 开启绿色... | alitajs/templates | InfoImageListPage/src/pages/index.tsx | TypeScript |
ArrowFunction |
(val) => (
<Item key={val.id}>
<Flex direction | alitajs/templates | InfoImageListPage/src/pages/index.tsx | TypeScript |
InterfaceDeclaration |
interface PageProps { } | alitajs/templates | InfoImageListPage/src/pages/index.tsx | TypeScript |
ArrowFunction |
props => <Label {...props}>{checked ? <Spinner /> | Fmstrat/fluentui | packages/react-examples/src/react-experiments/Toggle/Toggle.Example.tsx | TypeScript |
ArrowFunction |
(ev: React.MouseEvent<HTMLElement>, checked: boolean) => {
console.log('toggle is ' + (checked ? 'checked' : 'not checked'));
} | Fmstrat/fluentui | packages/react-examples/src/react-experiments/Toggle/Toggle.Example.tsx | TypeScript |
ArrowFunction |
(ev: React.MouseEvent<HTMLElement>, checked: boolean) => {
console.log('toggle is ' + (checked ? 'checked' : 'not checked'));
this.setState({ checked });
} | Fmstrat/fluentui | packages/react-examples/src/react-experiments/Toggle/Toggle.Example.tsx | TypeScript |
ClassDeclaration |
export class ToggleExample extends React.Component<{}, IToggleExampleState> {
private _toggle = React.createRef<IToggle>();
constructor(props: {}) {
super(props);
this.state = { checked: true };
}
public render(): JSX.Element {
const { checked } = this.state;
return (
<div>
<Tog... | Fmstrat/fluentui | packages/react-examples/src/react-experiments/Toggle/Toggle.Example.tsx | TypeScript |
InterfaceDeclaration |
export interface IToggleExampleState {
checked: boolean;
} | Fmstrat/fluentui | packages/react-examples/src/react-experiments/Toggle/Toggle.Example.tsx | TypeScript |
MethodDeclaration |
public render(): JSX.Element {
const { checked } = this.state;
return (
<div>
<Toggle defaultChecked={true} onText="No Label" offText="No Label" onChange={this._onChange} />
<Toggle defaultChecked={true} label="No Text" onChange={this._onChange} />
<Toggle defaultChecked={true} la... | Fmstrat/fluentui | packages/react-examples/src/react-experiments/Toggle/Toggle.Example.tsx | TypeScript |
MethodDeclaration |
checked ? <Spinner | Fmstrat/fluentui | packages/react-examples/src/react-experiments/Toggle/Toggle.Example.tsx | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-message-box-docs',
templateUrl: './message-box-docs.component.html'
})
export class MessageBoxDocsComponent {
objectBased: ExampleFile[] = [
{
language: 'html',
code: objectBasedHtml,
fileName: 'object-based-message-box-example'
... | Lukakatche/fundamental-ngx | apps/docs/src/app/core/component-docs/message-box/message-box-docs.component.ts | TypeScript |
ArrowFunction |
() => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: KtDemoApiService = TestBed.get(KtDemoApiService);
expect(service).toBeTruthy();
});
} | ahmetuysal/KT-Hackathon19-Frontend | src/app/shared/services/kt-demo-api.service.spec.ts | TypeScript |
ArrowFunction |
() => {
const service: KtDemoApiService = TestBed.get(KtDemoApiService);
expect(service).toBeTruthy();
} | ahmetuysal/KT-Hackathon19-Frontend | src/app/shared/services/kt-demo-api.service.spec.ts | TypeScript |
ClassDeclaration |
@Controller('tipo-prestador')
export class TipoPrestadorController {
constructor(private readonly tipoPresService: TipoPrestadorService) {}
@Get()
findAllTipoPrestadores() {
return this.tipoPresService.findAllTipoPrestadores();
}
} | VALAV/valav-backend | src/modules/tipo-prestador/tipo-prestador.controller.ts | TypeScript |
MethodDeclaration |
@Get()
findAllTipoPrestadores() {
return this.tipoPresService.findAllTipoPrestadores();
} | VALAV/valav-backend | src/modules/tipo-prestador/tipo-prestador.controller.ts | TypeScript |
ArrowFunction |
async () => {
const cluster = new Cluster(connStr, options)
await cluster._clusterConnect()
return cluster
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
() => exec.query<TRow>(statement, options_) | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
() => exec.query(indexName, query, options_) | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
() => exec.diagnostics(options_) | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
() => exec.ping(options_) | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
async () => {
const closeOneConn = async (conn: Connection) => {
return PromiseHelper.wrap<void>((wrapCallback) => {
conn.close(wrapCallback)
})
}
let allConns = Object.values(this._conns)
this._conns = {}
if (this._clusterConn) {
allConns = [...allConn... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
async (conn: Connection) => {
return PromiseHelper.wrap<void>((wrapCallback) => {
conn.close(wrapCallback)
})
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
(wrapCallback) => {
conn.close(wrapCallback)
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
(conn) => closeOneConn(conn) | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
const connOpts = this._buildConnOpts({})
const conn = new Connection(connOpts)
conn.connect((err) => {
if (err) {
return reject(err)
}
this._clusterConn = conn
resolve(null)
})
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
(err) => {
if (err) {
return reject(err)
}
this._clusterConn = conn
resolve(null)
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
() => {
// TODO(brett19): Handle the close error here...
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
(err: Error | null) => {
if (err) {
libLogger('failed to connect to bucket: %O', err)
conn.close(() => undefined)
}
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
InterfaceDeclaration | /**
* Specifies the options which can be specified when connecting
* to a cluster.
*
* @category Core
*/
export interface ConnectOptions {
/**
* Specifies a username to use for an implicitly created IPasswordAuthenticator
* used for authentication with the cluster.
*/
username?: string
/**
* Spe... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
@internal
*/
static async connect(
connStr: string,
options?: ConnectOptions,
callback?: NodeCallback<Cluster>
): Promise<Cluster> {
return PromiseHelper.wrapAsync(async () => {
const cluster = new Cluster(connStr, options)
await cluster._clusterConnect()
return cluster
}... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Creates a Bucket object reference to a specific bucket.
*
* @param bucketName The name of the bucket to reference.
*/
bucket(bucketName: string): Bucket {
return new Bucket(this, bucketName)
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Returns a UserManager which can be used to manage the users
* of this cluster.
*/
users(): UserManager {
return new UserManager(this)
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Returns a BucketManager which can be used to manage the buckets
* of this cluster.
*/
buckets(): BucketManager {
return new BucketManager(this)
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Returns a QueryIndexManager which can be used to manage the query indexes
* of this cluster.
*/
queryIndexes(): QueryIndexManager {
return new QueryIndexManager(this)
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Returns a AnalyticsIndexManager which can be used to manage the analytics
* indexes of this cluster.
*/
analyticsIndexes(): AnalyticsIndexManager {
return new AnalyticsIndexManager(this)
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Returns a SearchIndexManager which can be used to manage the search
* indexes of this cluster.
*/
searchIndexes(): SearchIndexManager {
return new SearchIndexManager(this)
} | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Executes a N1QL query against the cluster.
*
* @param statement The N1QL statement to execute.
* @param options Optional parameters for this operation.
* @param callback A node-style callback to be invoked after execution.
*/
query<TRow = any>(
statement: string,
options?: QueryOptions,
... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Executes an analytics query against the cluster.
*
* @param statement The analytics statement to execute.
* @param options Optional parameters for this operation.
* @param callback A node-style callback to be invoked after execution.
*/
analyticsQuery<TRow = any>(
statement: string,
opti... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Executes a search query against the cluster.
*
* @param indexName The name of the index to query.
* @param query The SearchQuery describing the query to execute.
* @param options Optional parameters for this operation.
* @param callback A node-style callback to be invoked after execution.
*/
... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Returns a diagnostics report about the currently active connections with the
* cluster. Includes information about remote and local addresses, last activity,
* and other diagnostics information.
*
* @param options Optional parameters for this operation.
* @param callback A node-style callback t... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Performs a ping operation against the cluster. Pinging the services which
* are specified (or all services if none are specified). Returns a report
* which describes the outcome of the ping operations which were performed.
*
* @param options Optional parameters for this operation.
* @param cal... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* Shuts down this cluster object. Cleaning up all resources associated with it.
*
* @param callback A node-style callback to be invoked after execution.
*/
close(callback?: NodeCallback<void>): Promise<void> {
return PromiseHelper.wrapAsync(async () => {
const closeOneConn = async (conn: Conn... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration |
private _buildConnOpts(
extraOpts: Partial<ConnectionOptions>
): ConnectionOptions {
const connOpts = {
connStr: this._connStr,
trustStorePath: this._trustStorePath,
logFunc: this._logFunc,
kvTimeout: this._kvTimeout,
kvDurableTimeout: this._kvDurableTimeout,
viewTimeout: ... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration |
private async _clusterConnect() {
return new Promise((resolve, reject) => {
const connOpts = this._buildConnOpts({})
const conn = new Connection(connOpts)
conn.connect((err) => {
if (err) {
return reject(err)
}
this._clusterConn = conn
resolve(null)
... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
@internal
*/
_getClusterConn(): Connection {
if (this._closed) {
throw new ClusterClosedError()
}
if (this._clusterConn) {
return this._clusterConn
}
const conns = Object.values(this._conns)
if (conns.length === 0) {
throw new NeedOpenBucketError()
}
return c... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
MethodDeclaration | /**
* @internal
*/
_getConn(options: { bucketName: string }): Connection {
if (this._closed) {
throw new ClusterClosedError()
}
// Hijack the cluster-level connection if it is available
if (this._clusterConn) {
this._clusterConn.close(() => {
// TODO(brett19): Handle the close... | bett3r-dev/couchnode | lib/cluster.ts | TypeScript |
ArrowFunction |
() => {
let borrower: Borrower;
beforeEach(() => {
borrower = new Borrower(borrowerOptions);
});
it("has a name.", () => {
expect(borrower.getName()).toBeDefined();
});
it("has a borrower id.", () => {
expect(borrower.getBorrowerId()).toBeDefined();
});
describe("Borrower Id", () => {
... | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
borrower = new Borrower(borrowerOptions);
} | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(borrower.getName()).toBeDefined();
} | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(borrower.getBorrowerId()).toBeDefined();
} | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
it("has an id.", () => {
expect(borrower.getId()).toBeDefined();
});
it("generates new id for every borrower.", () => {
const ids: string[] = Array(40)
.fill(0)
.map(
(_, i) =>
new Borrower({ name: `Book-${i}`, borrowerId: "borrower-id" })
... | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(borrower.getId()).toBeDefined();
} | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
const ids: string[] = Array(40)
.fill(0)
.map(
(_, i) =>
new Borrower({ name: `Book-${i}`, borrowerId: "borrower-id" })
)
.map((borrower) => borrower.getId());
ids.forEach((currentId) => {
const idsThatAreEqualToCurrentId = ids.filter((... | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
(_, i) =>
new Borrower({ name: `Book-${i}`, borrowerId: "borrower-id" }) | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
(borrower) => borrower.getId() | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
(currentId) => {
const idsThatAreEqualToCurrentId = ids.filter((id) => id == currentId)
.length;
expect(idsThatAreEqualToCurrentId).toBe(1);
} | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
(id) => id == currentId | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
let book: Book;
beforeEach(() => {
book = new Book({
name: "Book 1",
quantity: 1,
});
borrower.borrowBook(book);
});
it("is able to borrow book", () => {
const bookToBorrow = new Book({
name: "Book to borrow",
quantity: 1,
});
... | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
book = new Book({
name: "Book 1",
quantity: 1,
});
borrower.borrowBook(book);
} | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
const bookToBorrow = new Book({
name: "Book to borrow",
quantity: 1,
});
borrower.borrowBook(bookToBorrow);
expect(borrower.hasBorrowedBook(bookToBorrow)).toBeTruthy();
} | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(() => borrower.borrowBook(book)).toThrow();
} | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => borrower.borrowBook(book) | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(borrower.hasBorrowedBook(book)).toBeTruthy();
} | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
ArrowFunction |
() => {
borrower.returnBook(book);
expect(borrower.hasBorrowedBook(book)).toBeFalsy();
} | fraol0912/bookeeper | core/__tests__/entities/Borrower.spec.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.