type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction |
() => {
this.store.toggleAuthDialog = jest.fn();
const wrapper = shallow(<PublishButton appState={this.store} />);
wrapper.find('button').simulate('click');
expect(this.store.toggleAuthDialog).toHaveBeenCalled();
} | bradparks/fiddle__electron_fiddle_snippet_try_out | tests/renderer/components/publish-button-spec.tsx | TypeScript |
ArrowFunction |
async () => {
this.store.gitHubToken = 'github-token';
const wrapper = shallow(<PublishButton appState={this.store} />);
const instance: PublishButton = wrapper.instance() as any;
instance.publishFiddle = jest.fn();
await instance.handleClick();
expect(instance.publishFiddle).toHaveBeenCalled... | bradparks/fiddle__electron_fiddle_snippet_try_out | tests/renderer/components/publish-button-spec.tsx | TypeScript |
ArrowFunction |
async () => {
const mockOctokit = {
authenticate: jest.fn(),
gists: {
create: jest.fn(async () => ({ data: { id: '123' } }))
}
};
(getOctokit as any).mockReturnValue(mockOctokit);
const wrapper = shallow(<PublishButton appState={this.store} />);
const instance: PublishBu... | bradparks/fiddle__electron_fiddle_snippet_try_out | tests/renderer/components/publish-button-spec.tsx | TypeScript |
ArrowFunction |
async () => ({ data: { id: '123' } }) | bradparks/fiddle__electron_fiddle_snippet_try_out | tests/renderer/components/publish-button-spec.tsx | TypeScript |
ArrowFunction |
async () => {
const mockOctokit = {
authenticate: jest.fn(),
gists: {
create: jest.fn(() => {
throw new Error('bwap bwap');
})
}
};
(getOctokit as any).mockReturnValue(mockOctokit);
const wrapper = shallow(<PublishButton appState={this.store} />);
const... | bradparks/fiddle__electron_fiddle_snippet_try_out | tests/renderer/components/publish-button-spec.tsx | TypeScript |
ArrowFunction |
() => {
throw new Error('bwap bwap');
} | bradparks/fiddle__electron_fiddle_snippet_try_out | tests/renderer/components/publish-button-spec.tsx | TypeScript |
ArrowFunction |
error => this.props.onError(error) | mrkosima/adyen-web | packages/lib/src/components/Dropin/Dropin.tsx | TypeScript |
ArrowFunction |
() => {
const { data, isValid } = this.activePaymentMethod;
if (!isValid) {
this.showValidation();
return false;
}
return this.props.onSubmit({ data, isValid }, this);
} | mrkosima/adyen-web | packages/lib/src/components/Dropin/Dropin.tsx | TypeScript |
ArrowFunction |
state => this.props.onAdditionalDetails(state, this) | mrkosima/adyen-web | packages/lib/src/components/Dropin/Dropin.tsx | TypeScript |
ClassDeclaration |
class DropinElement extends UIElement<DropinElementProps> {
public static type = 'dropin';
protected static defaultProps = defaultProps;
public dropinRef = null;
constructor(props) {
super(props);
this.submit = this.submit.bind(this);
}
get isValid() {
return !!this.dr... | mrkosima/adyen-web | packages/lib/src/components/Dropin/Dropin.tsx | TypeScript |
MethodDeclaration |
showValidation() {
if (this.dropinRef.state.activePaymentMethod) {
this.dropinRef.state.activePaymentMethod.showValidation();
}
return this;
} | mrkosima/adyen-web | packages/lib/src/components/Dropin/Dropin.tsx | TypeScript |
MethodDeclaration |
setStatus(status, props = {}) {
this.dropinRef.setStatus({ type: status, props });
return this;
} | mrkosima/adyen-web | packages/lib/src/components/Dropin/Dropin.tsx | TypeScript |
MethodDeclaration | /**
* Calls the onSubmit event with the state of the activePaymentMethod
*/
submit(): void {
if (!this.activePaymentMethod) {
throw new Error('No active payment method.');
}
this.activePaymentMethod
.startPayment()
.then(this.handleSubmit)
... | mrkosima/adyen-web | packages/lib/src/components/Dropin/Dropin.tsx | TypeScript |
MethodDeclaration |
handleAction(action: PaymentAction) {
if (!action || !action.type) throw new Error('Invalid Action');
if (this.activePaymentMethod.updateWithAction) {
return this.activePaymentMethod.updateWithAction(action);
}
// Extract desired props that we need to pass on from the pmCo... | mrkosima/adyen-web | packages/lib/src/components/Dropin/Dropin.tsx | TypeScript |
MethodDeclaration |
render() {
return (
<CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext}>
<DropinComponent
{...this.props}
onChange={this.setState}
onSubmit={this.handleSubmit}
elementRef={thi... | mrkosima/adyen-web | packages/lib/src/components/Dropin/Dropin.tsx | TypeScript |
ClassDeclaration |
@Module({
providers: [CaslAbilityFactory],
exports: [CaslAbilityFactory],
})
export class CaslModule {} | kamalkech/nestjs-test | src/casl/casl.module.ts | TypeScript |
ArrowFunction |
() => {
const type = select(
'type',
['button', 'submit', 'reset'],
undefined
);
const appearance = select(
'appearance',
['basic', 'primary', 'success', 'alert', 'transparent'],
undefined
);
const size = select(
'size',
['tiny', 'regular', 'large'],
undefined
);
co... | RaghavShubham/design-system | core/components/atoms/button/__stories__/index.story.tsx | TypeScript |
MethodDeclaration |
action('button-clicked') | RaghavShubham/design-system | core/components/atoms/button/__stories__/index.story.tsx | TypeScript |
MethodDeclaration |
action('mouse-enter') | RaghavShubham/design-system | core/components/atoms/button/__stories__/index.story.tsx | TypeScript |
MethodDeclaration |
action('mouse-leave') | RaghavShubham/design-system | core/components/atoms/button/__stories__/index.story.tsx | TypeScript |
FunctionDeclaration | /**
* The Fade transition is used by the [Modal](https://mui.com/components/modal/) component.
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
*
* Demos:
*
* - [Transitions](https://mui.com/components/transitions/)
*
* API:
*
* - [Fade API](https://mui.com/api... | 94YOUNG/material-ui | packages/mui-material/src/Fade/Fade.d.ts | TypeScript |
InterfaceDeclaration |
export interface FadeProps extends Omit<TransitionProps, 'children'> {
/**
* Perform the enter transition when it first mounts if `in` is also `true`.
* Set this to `false` to disable this behavior.
* @default true
*/
appear?: boolean;
/**
* A single child content element.
*/
children: React.... | 94YOUNG/material-ui | packages/mui-material/src/Fade/Fade.d.ts | TypeScript |
FunctionDeclaration | /*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... | souhirzribi96/application-web-d-indexation-des-documents-GED-en-r-f-rence-la-plateforme-Alfresco | node_modules/@alfresco/adf-core/services/get-type.d.ts | TypeScript |
FunctionDeclaration |
function MyApp({ Component, pageProps }: AppProps) {
return (
<ChakraProvider theme={theme}>
<Component {...pageProps} />
</ChakraProvider>
);
} | Lucbm99/Desafio-Capitulo4-Ignite-WorldTrip | src/pages/_app.tsx | TypeScript |
ArrowFunction |
({ children }) => {
return (
<div className="antares-container">
<AntaresActions></AntaresActions>
<AntaresSidebar></AntaresSidebar>
{children}
</div> | arcanite24/antares-client | src/modules/ui/container/container.component.tsx | TypeScript |
FunctionDeclaration |
function generateSampleMessage<T extends object>(instance: T) {
const filledObject = (instance.constructor as typeof protobuf.Message)
.toObject(instance as protobuf.Message<T>, {defaults: true});
return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T;
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
FunctionDeclaration |
function stubSimpleCall<ResponseType>(response?: ResponseType, error?: Error) {
return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]);
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
FunctionDeclaration |
function stubSimpleCallWithCallback<ResponseType>(response?: ResponseType, error?: Error) {
return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response);
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
FunctionDeclaration |
function stubPageStreamingCall<ResponseType>(responses?: ResponseType[], error?: Error) {
const pagingStub = sinon.stub();
if (responses) {
for (let i = 0; i < responses.length; ++i) {
pagingStub.onCall(i).callsArgWith(2, null, responses[i]);
}
}
const transformStub = error ... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
FunctionDeclaration |
function stubAsyncIterationCall<ResponseType>(responses?: ResponseType[], error?: Error) {
let counter = 0;
const asyncIterable = {
[Symbol.asyncIterator]() {
return {
async next() {
if (error) {
return Promise.reject(error);
... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => { mockStream.write({}); } | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => { mockStream.end(); } | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const servicePath = assetserviceModule.v1p5beta1.AssetServiceClient.servicePath;
assert(servicePath);
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const apiEndpoint = assetserviceModule.v1p5beta1.AssetServiceClient.apiEndpoint;
assert(apiEndpoint);
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const port = assetserviceModule.v1p5beta1.AssetServiceClient.port;
assert(port);
assert(typeof port === 'number');
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient();
assert(client);
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
fallback: true,
});
assert(client);
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
assert.strictEqual(client.assetServiceStub, undefined);
await client.initialize();
a... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.close();
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const fakeProjectId = 'fake-project-id';
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.auth.getProjectId = sinon.stub().resolves(fa... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const fakeProjectId = 'fake-project-id';
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.auth.getProjectId = sinon.stub().callsArgWit... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
client.getProjectId((err?: Error|null, projectId?: string|null) => {
if (err) {
reject(err);
} else {
resolve(projectId);
}
});
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
(err?: Error|null, projectId?: string|null) => {
if (err) {
reject(err);
} else {
resolve(projectId);
}
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
const request = generateSampleMessage(new protos.go... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
const request = generateSampleMessage(new protos.go... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
client.listAssets(
request,
(err?: Error|null, result?: protos.google.cloud.asset.v1p5beta1.IAsset[]|null) => {
if (err) {
reject(err);
} else {
... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
(err?: Error|null, result?: protos.google.cloud.asset.v1p5beta1.IAsset[]|null) => {
if (err) {
reject(err);
} else {
resolve(result);
}
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
const request = generateSampleMessage(new protos.go... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
const request = generateSampleMessage(new protos.go... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
const responses: protos.google.cloud.asset.v1p5beta1.Asset[] = [];
stream.on('data', (response: protos.google.cloud.asset.v1p5beta1.Asset) => {
responses.push(response);
});
stream.on('end', () => {
... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
(response: protos.google.cloud.asset.v1p5beta1.Asset) => {
responses.push(response);
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
resolve(responses);
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
(err: Error) => {
reject(err);
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
const request = generateSampleMessage(new protos.go... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
const request = generateSampleMessage(new protos.google.clo... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
const request = generateSampleMessage(new protos.go... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
async () => {
const responses: protos.google.cloud.asset.v1p5beta1.IAsset[] = [];
for await (const resource of iterable) {
responses.push(resource!);
}
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
describe('accessLevel', () => {
const fakePath = "/rendered/path/accessLevel";
const expectedParameters = {
access_policy: "accessPolicyValue",
access_level: "accessLevelValue",
};
const client = new assetserviceModule.v1p... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const fakePath = "/rendered/path/accessLevel";
const expectedParameters = {
access_policy: "accessPolicyValue",
access_level: "accessLevelValue",
};
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const result = client.accessLevelPath("accessPolicyValue", "accessLevelValue");
assert.strictEqual(result, fakePath);
assert((client.pathTemplates.accessLevelPathTemplate.render as SinonStub)
.getCall(-1).calledWith(expectedParameters));
... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const result = client.matchAccessPolicyFromAccessLevelName(fakePath);
assert.strictEqual(result, "accessPolicyValue");
assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub)
.getCall(-1).calledWith(fakePath));
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const result = client.matchAccessLevelFromAccessLevelName(fakePath);
assert.strictEqual(result, "accessLevelValue");
assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub)
.getCall(-1).calledWith(fakePath));
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const fakePath = "/rendered/path/accessPolicy";
const expectedParameters = {
access_policy: "accessPolicyValue",
};
const client = new assetserviceModule.v1p5beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_k... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const result = client.accessPolicyPath("accessPolicyValue");
assert.strictEqual(result, fakePath);
assert((client.pathTemplates.accessPolicyPathTemplate.render as SinonStub)
.getCall(-1).calledWith(expectedParameters));
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const result = client.matchAccessPolicyFromAccessPolicyName(fakePath);
assert.strictEqual(result, "accessPolicyValue");
assert((client.pathTemplates.accessPolicyPathTemplate.match as SinonStub)
.getCall(-1).calledWith(fakePath));
} | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const fakePath = "/rendered/path/servicePerimeter";
const expectedParameters = {
access_policy: "accessPolicyValue",
service_perimeter: "servicePerimeterValue",
};
const client = new assetserviceModule.v1p5beta1.AssetServiceClient(... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const result = client.servicePerimeterPath("accessPolicyValue", "servicePerimeterValue");
assert.strictEqual(result, fakePath);
assert((client.pathTemplates.servicePerimeterPathTemplate.render as SinonStub)
.getCall(-1).calledWith(expectedPara... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const result = client.matchAccessPolicyFromServicePerimeterName(fakePath);
assert.strictEqual(result, "accessPolicyValue");
assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub)
.getCall(-1).calledWith(fakePath));
... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
() => {
const result = client.matchServicePerimeterFromServicePerimeterName(fakePath);
assert.strictEqual(result, "servicePerimeterValue");
assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub)
.getCall(-1).calledWith(fakePath)... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
MethodDeclaration |
[Symbol.asyncIterator]() {
return {
async next() {
if (error) {
return Promise.reject(error);
}
if (counter >= responses!.length) {
return Promise.resolve({done: true, value: undefine... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
MethodDeclaration |
async next() {
if (error) {
return Promise.reject(error);
}
if (counter >= responses!.length) {
return Promise.resolve({done: true, value: undefined});
}
return Promise.re... | googleapis/googleapis-gen | google/cloud/asset/v1p5beta1/asset-v1p5beta1-nodejs/test/gapic_asset_service_v1p5beta1.ts | TypeScript |
ArrowFunction |
(nth: number) => {
const s = nth % 100;
if (s > 3 && s < 21) return "th";
switch (s % 10) {
case 1:
return "st";
case 2:
return "nd";
case 3:
return "rd";
default:
return "th";
}
} | Abduvakilov/flatpickr | src/l10n/default.ts | TypeScript |
FunctionDeclaration |
function AllServices() {
return (
<div>
<Layout>
<Headers
pageName={[{ name: 'Services', route: '/services' }]}
tabHeaders={['All services', 'Service Groups (clusters)', 'Settings']}
// 'TODO revamp service global setting'
Components={[<ServicesList />, <Serv... | 0xflotus/trasa | dashboard/src/pages/Services/index.tsx | TypeScript |
ArrowFunction |
() => {
return (
<Switch>
<Route exact path="/services" component={AllServices} />
<Route path="/services/groups/group/:ID" component={GroupPage} />
<Route path="/services/service/:ID" component={ServicePage} />
</Switch> | 0xflotus/trasa | dashboard/src/pages/Services/index.tsx | TypeScript |
ArrowFunction |
(
event: React.MouseEvent<HTMLButtonElement>,
) => {
if (this.props.isActionDisabled) {
return;
}
this.props.disableAction();
event.stopPropagation();
const action = (event.currentTarget.name as any) as ChangeOperation;
this.props.updateTranslat... | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
ArrowFunction |
(
event: React.MouseEvent<HTMLButtonElement>,
) => {
if (this.props.isActionDisabled) {
return;
}
this.props.disableAction();
event.stopPropagation();
this.props.deleteTranslation(this.props.translation.pk);
} | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
ArrowFunction |
() => {
if (this.props.isReadOnlyEditor) {
return;
}
// Ignore if selecting text
if (window.getSelection().toString()) {
return;
}
this.props.updateEditorTranslation(
this.props.translation.string,
'history',
);
... | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
ArrowFunction |
(event: React.MouseEvent) => void | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
ArrowFunction |
(
event: React.MouseEvent,
) => {
event.stopPropagation();
this.setState((state) => {
return { areCommentsVisible: !state.areCommentsVisible };
});
} | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
ArrowFunction |
(state) => {
return { areCommentsVisible: !state.areCommentsVisible };
} | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
ArrowFunction |
(
event: React.MouseEvent,
) => {
event.stopPropagation();
this.setState((state) => {
return { isDiffVisible: !state.isDiffVisible };
});
} | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
ArrowFunction |
(state) => {
return { isDiffVisible: !state.isDiffVisible };
} | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
ClassDeclaration | /**
* Render a translation in the History tab.
*
* Shows the translation's status, date, author and reviewer, as well as
* the content of the translation.
*
* The status can be interact with if the user has sufficient permissions to
* change said status.
*/
export class TranslationBase extends React.Component<I... | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
TypeAliasDeclaration |
type Props = {
entity: Entity;
isReadOnlyEditor: boolean;
isTranslator: boolean;
translation: HistoryTranslation;
activeTranslation: HistoryTranslation;
locale: Locale;
user: UserState;
index: number;
deleteTranslation: (id: number) => void;
addComment: (comment: string, id: num... | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
TypeAliasDeclaration |
type InternalProps = Props & {
isActionDisabled: boolean;
disableAction: () => void;
}; | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
TypeAliasDeclaration |
type State = {
isDiffVisible: boolean;
areCommentsVisible: boolean;
}; | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
MethodDeclaration |
getStatus(): string {
const { translation } = this.props;
if (translation.approved) {
return 'approved';
}
if (translation.fuzzy) {
return 'fuzzy';
}
if (translation.rejected) {
return 'rejected';
}
return 'unreviewed'... | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
MethodDeclaration |
getApprovalTitle(): string {
const { translation } = this.props;
// TODO: To Localize.
if (translation.approved && translation.approvedUser) {
return `Approved by ${translation.approvedUser}`;
}
if (translation.unapprovedUser) {
return `Unapproved by ${t... | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
MethodDeclaration |
renderUser(): React.ReactElement<'a'> | React.ReactElement<'span'> {
const { translation } = this.props;
if (!translation.uid) {
return <span>{translation.user}</span>;
}
return (
<a
href={`/contributors/${translation.username}`} | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
MethodDeclaration |
stopPropagation() | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
MethodDeclaration |
if (isReadOnlyEditor) {
// Copying into the editor is not allowed
className += ' cannot-copy';
} | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
MethodDeclaration |
if (isTranslator | Stellaris-Mod-Translate/pontoon | frontend/src/modules/history/components/Translation.tsx | TypeScript |
ArrowFunction |
registration => !isValueProvider(registration.provider) | launchtray/tsyringe | src/dependency-container.ts | TypeScript |
ArrowFunction |
registration => {
registration.instance = undefined;
return registration;
} | launchtray/tsyringe | src/dependency-container.ts | TypeScript |
ArrowFunction |
({options}) => options.lifecycle === Lifecycle.ContainerScoped | launchtray/tsyringe | src/dependency-container.ts | TypeScript |
ArrowFunction |
registration => {
if (registration.options.lifecycle === Lifecycle.ContainerScoped) {
return {
provider: registration.provider,
options: registration.options
};
}
return registration;
} | launchtray/tsyringe | src/dependency-container.ts | TypeScript |
ArrowFunction |
async (param: ParamInfo, idx: number) => {
try {
if (isTokenDescriptor(param)) {
return param.multiple
? await this.resolveAll(param.token)
: await this.resolve(param.token, context);
}
return await this.resolve(param, context);
} catch (e) {
... | launchtray/tsyringe | src/dependency-container.ts | TypeScript |
TypeAliasDeclaration |
export type Registration<T = any> = {
provider: Provider<T>;
options: RegistrationOptions;
instance?: T;
}; | launchtray/tsyringe | src/dependency-container.ts | TypeScript |
TypeAliasDeclaration |
export type ParamInfo = TokenDescriptor | InjectionToken<any>; | launchtray/tsyringe | src/dependency-container.ts | TypeScript |
MethodDeclaration | /**
* Register a dependency provider.
*
* @param provider {Provider} The dependency provider
*/
public register<T>(
token: InjectionToken<T>,
provider: ValueProvider<T>
): InternalDependencyContainer; | launchtray/tsyringe | src/dependency-container.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.