type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
ClassDeclaration |
@Component({
selector: 'datatable-row-wrapper',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div *ngIf="groupHeader && groupHeader.template" class="datatable-group-header" [ngStyle]="getGroupHeaderStyle()">
<ng-template
*ngIf="groupHeader && groupHeader.template"
[ngTem... | sst-lending/ngx-datatable | projects/swimlane/ngx-datatable/src/lib/components/body/body-row-wrapper.component.ts | TypeScript |
MethodDeclaration |
ngOnChanges({ row: rowChange }: SimpleChanges): void {
if (rowChange) {
this.rowContext.row = this.row;
this.groupContext.group = this.row;
this.cd.markForCheck();
}
} | sst-lending/ngx-datatable | projects/swimlane/ngx-datatable/src/lib/components/body/body-row-wrapper.component.ts | TypeScript |
MethodDeclaration |
@HostListener('contextmenu', ['$event'])
onContextmenu($event: MouseEvent): void {
this.rowContextmenu.emit({ event: $event, row: this.row });
} | sst-lending/ngx-datatable | projects/swimlane/ngx-datatable/src/lib/components/body/body-row-wrapper.component.ts | TypeScript |
MethodDeclaration |
getGroupHeaderStyle(): any {
const styles = {};
styles['transform'] = 'translate3d(' + this.offsetX + 'px, 0px, 0px)';
styles['backface-visibility'] = 'hidden';
styles['width'] = this.innerWidth;
return styles;
} | sst-lending/ngx-datatable | projects/swimlane/ngx-datatable/src/lib/components/body/body-row-wrapper.component.ts | TypeScript |
ArrowFunction |
() => {
actions.operators = {
...actions.operators,
getCSV: jest.fn(),
getResource: jest.fn(),
};
const mockDispatch = jest.fn(res => res);
spyOnUseDispatch = jest.spyOn(ReactRedux, "useDispatch").mockReturnValue(mockDispatch);
} | faraz891/kubeapps | dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.v2.test.tsx | TypeScript |
ArrowFunction |
res => res | faraz891/kubeapps | dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.v2.test.tsx | TypeScript |
ArrowFunction |
() => {
actions.operators = { ...kubeaActions };
spyOnUseDispatch.mockRestore();
} | faraz891/kubeapps | dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.v2.test.tsx | TypeScript |
ArrowFunction |
() => {
const props = { ...defaultProps, cluster: "other-cluster" };
const wrapper = mountWrapper(defaultStore, <OperatorInstanceUpdateForm {...props} />);
expect(wrapper.find(OperatorNotSupported)).toExist();
} | faraz891/kubeapps | dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.v2.test.tsx | TypeScript |
ArrowFunction |
() => {
const getResource = jest.fn();
const getCSV = jest.fn();
actions.operators.getResource = getResource;
actions.operators.getCSV = getCSV;
mountWrapper(defaultStore, <OperatorInstanceUpdateForm {...defaultProps} />);
expect(getCSV).toHaveBeenCalledWith(
defaultProps.cluster,
defaultProps.name... | faraz891/kubeapps | dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.v2.test.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = mountWrapper(
getStore({
operators: {
resource: defaultResource,
csv: defaultCSV,
},
}),
<OperatorInstanceUpdateForm {...defaultProps} />,
);
expect(wrapper.find(OperatorInstanceFormBody).props()).toMatchObject({
defaultValues: "kind: Foo\napiVe... | faraz891/kubeapps | dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.v2.test.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = mountWrapper(defaultStore, <OperatorInstanceUpdateForm {...defaultProps} />);
expect(wrapper.find(Alert)).toIncludeText("Resource my-foo not found");
} | faraz891/kubeapps | dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.v2.test.tsx | TypeScript |
ArrowFunction |
() => {
const updateResource = jest.fn();
actions.operators.updateResource = updateResource;
const wrapper = mountWrapper(
getStore({
operators: {
resource: defaultResource,
csv: defaultCSV,
},
}),
<OperatorInstanceUpdateForm {...defaultProps} />,
);
const form = wrap... | faraz891/kubeapps | dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.v2.test.tsx | TypeScript |
ArrowFunction |
(howMany: number, word: string) => {
return `${howMany} ${pluralize(word, howMany)}`;
} | ceres23/api-oas-checker-action | src/utils.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class AuthService {
constructor(private readonly configService: ConfigService) {
const mongoConStr = this.configService.get<string>('MONGODB_WRITE_CONNECTHION_STRING')
console.log(mongoConStr)
}
} | artyrkozel/nest | src/auth/auth.service.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class StudentService {
products = [
{ id: 1, name: 'One Plus 7', price: 48000 },
{ id: 2, name: 'I Phone X', price: 64999 },
];
constructor(@InjectModel('Student') private studentRepository:Model<student>){}
getData()
{
return this.products;
}
... | wizba/training | src/student/student/student.service.ts | TypeScript |
MethodDeclaration |
getData()
{
return this.products;
} | wizba/training | src/student/student/student.service.ts | TypeScript |
MethodDeclaration |
async addCustomer(createCustomerDTO): Promise<student> {
const newCustomer = await this.studentRepository.create(createCustomerDTO)
return newCustomer;
} | wizba/training | src/student/student/student.service.ts | TypeScript |
ClassDeclaration | /**
* <p>Creates an application, optionally including an AWS SAM file to create the first application version in the same call.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ServerlessApplicationRepositoryClient, CreateApplicationCommand } from "@... | AllanZhengYP/aws-sdk-js-v3 | clients/client-serverlessapplicationrepository/src/commands/CreateApplicationCommand.ts | TypeScript |
InterfaceDeclaration |
export interface CreateApplicationCommandInput extends CreateApplicationRequest {} | AllanZhengYP/aws-sdk-js-v3 | clients/client-serverlessapplicationrepository/src/commands/CreateApplicationCommand.ts | TypeScript |
InterfaceDeclaration |
export interface CreateApplicationCommandOutput extends CreateApplicationResponse, __MetadataBearer {} | AllanZhengYP/aws-sdk-js-v3 | clients/client-serverlessapplicationrepository/src/commands/CreateApplicationCommand.ts | TypeScript |
MethodDeclaration | /**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: ServerlessApplicationRepositoryClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<CreateApplicationCommandInput, CreateApplicationCommandOutput> {
this.middlewar... | AllanZhengYP/aws-sdk-js-v3 | clients/client-serverlessapplicationrepository/src/commands/CreateApplicationCommand.ts | TypeScript |
MethodDeclaration |
private serialize(input: CreateApplicationCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_restJson1CreateApplicationCommand(input, context);
} | AllanZhengYP/aws-sdk-js-v3 | clients/client-serverlessapplicationrepository/src/commands/CreateApplicationCommand.ts | TypeScript |
MethodDeclaration |
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<CreateApplicationCommandOutput> {
return deserializeAws_restJson1CreateApplicationCommand(output, context);
} | AllanZhengYP/aws-sdk-js-v3 | clients/client-serverlessapplicationrepository/src/commands/CreateApplicationCommand.ts | TypeScript |
ClassDeclaration |
export class AnnouncementsMongoDbPersistence
extends IdentifiableMongoDbPersistence<AnnouncementV1, string>
implements IAnnouncementsPersistence {
constructor() {
super('announcements');
}
private composeFilter(filter: FilterParams): any {
filter = filter || new FilterParams();
... | pip-services-support/pip-services-announcements-node | src/persistence/AnnouncementsMongoDbPersistence.ts | TypeScript |
MethodDeclaration |
private composeFilter(filter: FilterParams): any {
filter = filter || new FilterParams();
let criteria = [];
let search = filter.getAsNullableString('search');
if (search != null) {
let searchRegex = new RegExp(search, "i");
let searchCriteria = [];
... | pip-services-support/pip-services-announcements-node | src/persistence/AnnouncementsMongoDbPersistence.ts | TypeScript |
MethodDeclaration |
public getPageByFilter(correlationId: string, filter: FilterParams, paging: PagingParams, callback: any) {
super.getPageByFilter(correlationId, this.composeFilter(filter), paging, '-create_time', null, callback);
} | pip-services-support/pip-services-announcements-node | src/persistence/AnnouncementsMongoDbPersistence.ts | TypeScript |
MethodDeclaration |
public getOneRandom(correlationId: string, filter: FilterParams,
callback: (err: any, item: AnnouncementV1) => void): void {
super.getOneRandom(correlationId, this.composeFilter(filter), callback);
} | pip-services-support/pip-services-announcements-node | src/persistence/AnnouncementsMongoDbPersistence.ts | TypeScript |
ClassDeclaration |
@Component({
template: `<div
style.color="a{{one}}b"
style.border="a{{one}}b"
[class.apple]="yesToApple"
[style.transition]="transition"
[class.orange]="yesToOrange"
[style.width]="width"
... | 017-Ddas/angular | packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/chaining/break_different_instructions.ts | TypeScript |
ClassDeclaration |
export default class Shell extends Component<ShellProps, any> {
static Branding: ComponentType<ShellCommonProps>;
static Action: ComponentType<ShellCommonProps>;
static MultiTask: ComponentType<ShellCommonProps>;
static AppBar: ComponentType<ShellCommonProps>;
static Content: ComponentType<ShellCom... | Mavericker-1996/next | types/shell/index.d.ts | TypeScript |
InterfaceDeclaration |
export interface ShellProps extends HTMLAttributes<HTMLElement>, CommonProps {
/**
* 设备类型,针对不同的设备类型组件做出对应的响应式变化
*/
device?: 'tablet' | 'desktop' | 'phone';
type?: 'light' | 'dark' | 'brand';
fixedHeader?: boolean;
} | Mavericker-1996/next | types/shell/index.d.ts | TypeScript |
InterfaceDeclaration |
export interface ShellCommonProps extends HTMLAttributes<HTMLElement>, CommonProps {
} | Mavericker-1996/next | types/shell/index.d.ts | TypeScript |
InterfaceDeclaration |
export interface ShellNavigationProps extends ShellCommonProps {
collapse?: boolean;
direction?: 'hoz' | 'ver';
align?: 'left' | 'right' | 'center';
fixed?: boolean;
onCollapseChange?: (collapse?: boolean) => {};
} | Mavericker-1996/next | types/shell/index.d.ts | TypeScript |
InterfaceDeclaration |
export interface ShellLocalNavigationProps extends ShellCommonProps {
collapse?: boolean;
onCollapseChange?: (collapse?: boolean) => {};
} | Mavericker-1996/next | types/shell/index.d.ts | TypeScript |
InterfaceDeclaration |
export interface ShellToolDockProps extends ShellCommonProps {
collapse?: boolean;
fixed?: boolean;
onCollapseChange?: (collapse?: boolean) => {};
} | Mavericker-1996/next | types/shell/index.d.ts | TypeScript |
InterfaceDeclaration |
export interface ShellAncillaryProps extends ShellCommonProps {
collapse?: boolean;
onCollapseChange?: (collapse?: boolean) => {};
} | Mavericker-1996/next | types/shell/index.d.ts | TypeScript |
ArrowFunction |
(filename: string) =>
sqlBase.__dangerous__rawValue(readFileSync(filename, 'utf8')) | AmitMY/atdatabases | packages/sql/src/index.ts | TypeScript |
InterfaceDeclaration |
export interface SQL extends SQLBase {
file(filename: string): SQLQuery;
} | AmitMY/atdatabases | packages/sql/src/index.ts | TypeScript |
ClassDeclaration | /**
* Acquires an item for the specified type and ignites it
*/
export default class AcquireItemAndIgnite extends Objective {
constructor(private readonly itemType: ItemType) {
super();
}
public getIdentifier(): string {
return `AcquireItemAndIgnite:${ItemType[this.itemType]}`;
}
... | WaywardGame/tars | src/Objectives/Acquire/Item/AcquireItemAndIgnite.ts | TypeScript |
MethodDeclaration |
public getIdentifier(): string {
return `AcquireItemAndIgnite:${ItemType[this.itemType]}`;
} | WaywardGame/tars | src/Objectives/Acquire/Item/AcquireItemAndIgnite.ts | TypeScript |
MethodDeclaration |
public getStatus(): string | undefined {
return `Acquiring ${Translation.nameOf(Dictionary.Item, this.itemType).getString()} and igniting it`;
} | WaywardGame/tars | src/Objectives/Acquire/Item/AcquireItemAndIgnite.ts | TypeScript |
MethodDeclaration |
public override canIncludeContextHashCode(): boolean {
return true;
} | WaywardGame/tars | src/Objectives/Acquire/Item/AcquireItemAndIgnite.ts | TypeScript |
MethodDeclaration |
public override shouldIncludeContextHashCode(context: Context): boolean {
return context.isReservedItemType(this.itemType);
} | WaywardGame/tars | src/Objectives/Acquire/Item/AcquireItemAndIgnite.ts | TypeScript |
MethodDeclaration |
public async execute(context: Context): Promise<ObjectiveExecutionResult> {
const objectives: IObjective[] = [];
const itemToIgnite = itemUtilities.getItemInInventory(context, this.itemType);
if (itemToIgnite === undefined) {
objectives.push(new AcquireItem(this.itemType).setContex... | WaywardGame/tars | src/Objectives/Acquire/Item/AcquireItemAndIgnite.ts | TypeScript |
InterfaceDeclaration |
export interface IScatterPlotProps {
index: number;
data: ILine[];
axesScaleType?: IAxesScaleState;
chartTitle?: IChartTitle;
displayOutliers?: boolean;
highlightMode?: HighlightEnum;
zoom?: IChartZoom;
onZoomChange?: (zoom: Partial<IChartZoom>) => void;
syncHoverState: (args: ISyncHoverStateArgs) =>... | SSamDav/aim | aim/web/ui/src/components/ScatterPlot/types.d.ts | TypeScript |
MethodDeclaration |
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "notification" ("id" SERIAL NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "userId" integer NOT NULL, "isRead" boolean, "data" jsonb NOT NULL, CONSTRAINT "PK_705b6c7cdf9b2c2ff7ac7872cb7" ... | gozeon/hakka | server/migrations/1608889243136-init.ts | TypeScript |
MethodDeclaration |
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "comment" DROP CONSTRAINT "FK_e3aebe2bd1c53467a07109be596"`,
)
await queryRunner.query(
`ALTER TABLE "comment" DROP CONSTRAINT "FK_276779da446413a0d79598d4fbd"`,
)
await queryRunner.query(... | gozeon/hakka | server/migrations/1608889243136-init.ts | TypeScript |
ArrowFunction |
() => {
this.inputEventWasTriggered = true;
} | acrolinx/sidebar-sdk-js | test/spec/adapter-test-setups/content-editable.ts | TypeScript |
ClassDeclaration |
export class ContentEditableTestSetup implements AdapterTestSetup {
name = 'ContentEditableAdapter';
inputFormat = 'HTML';
editorElement = `<div id="editorId" style="height: ${EDITOR_HEIGHT}px; overflow-x: scroll; position: relative; font-size: 10px">initial text</div>`;
inputEventWasTriggered?: boolean;
in... | acrolinx/sidebar-sdk-js | test/spec/adapter-test-setups/content-editable.ts | TypeScript |
MethodDeclaration |
init() {
return Promise.resolve(new ContentEditableAdapter({editorId: 'editorId'}));
} | acrolinx/sidebar-sdk-js | test/spec/adapter-test-setups/content-editable.ts | TypeScript |
MethodDeclaration |
setEditorContent(html: string, done: DoneCallback) {
$('#editorId').html(html).on('input', () => {
this.inputEventWasTriggered = true;
});
done();
} | acrolinx/sidebar-sdk-js | test/spec/adapter-test-setups/content-editable.ts | TypeScript |
MethodDeclaration |
remove() {
$('#editorId').remove();
} | acrolinx/sidebar-sdk-js | test/spec/adapter-test-setups/content-editable.ts | TypeScript |
MethodDeclaration |
getSelectedText(): string {
return window.getSelection()!.toString();
} | acrolinx/sidebar-sdk-js | test/spec/adapter-test-setups/content-editable.ts | TypeScript |
FunctionDeclaration | /**
* This turns a node path into a valid state machine name, to try and improve
* the StepFunction's AWS console experience while minimizing the risk for
* collisons.
*/
function stateMachineNameFrom(nodePath: string): string {
// Poor man's replace all...
return nodePath.split(/[^a-z0-9+!@.()=_'-]+/i).join('.... | cdklabs/construct-hub | src/backend/ingestion/index.ts | TypeScript |
ClassDeclaration | /**
* A StepFunctions State Machine to reprocess every currently indexed package
* through the ingestion function. This should not be frequently required, but
* can come in handy at times.
*
* For more information, refer to the runbook at
* https://github.com/cdklabs/construct-hub/blob/main/docs/operator-runbook.... | cdklabs/construct-hub | src/backend/ingestion/index.ts | TypeScript |
InterfaceDeclaration |
export interface IngestionProps {
/**
* The bucket in which ingested objects are due to be inserted.
*/
readonly bucket: IBucket;
/**
* The CodeArtifact repository to which packages should be published. This is
* the ConstructHub internal CodeArtifact repository, if one exists.
*/
readonly code... | cdklabs/construct-hub | src/backend/ingestion/index.ts | TypeScript |
InterfaceDeclaration |
interface ReprocessIngestionWorkflowProps {
readonly bucket: IBucket;
readonly queue: IQueue;
} | cdklabs/construct-hub | src/backend/ingestion/index.ts | TypeScript |
MethodDeclaration |
public metricFoundLicenseFile(opts?: MetricOptions): Metric {
return new Metric({
period: Duration.minutes(5),
statistic: Statistic.SUM,
...opts,
metricName: MetricName.FOUND_LICENSE_FILE,
namespace: METRICS_NAMESPACE,
});
} | cdklabs/construct-hub | src/backend/ingestion/index.ts | TypeScript |
MethodDeclaration |
public metricIneligibleLicense(opts?: MetricOptions): Metric {
return new Metric({
period: Duration.minutes(5),
statistic: Statistic.SUM,
...opts,
metricName: MetricName.INELIGIBLE_LICENSE,
namespace: METRICS_NAMESPACE,
});
} | cdklabs/construct-hub | src/backend/ingestion/index.ts | TypeScript |
MethodDeclaration |
public metricInvalidAssembly(opts?: MetricOptions): Metric {
return new Metric({
period: Duration.minutes(5),
statistic: Statistic.SUM,
...opts,
metricName: MetricName.INVALID_ASSEMBLY,
namespace: METRICS_NAMESPACE,
});
} | cdklabs/construct-hub | src/backend/ingestion/index.ts | TypeScript |
MethodDeclaration |
public metricInvalidTarball(opts?: MetricOptions): Metric {
return new Metric({
period: Duration.minutes(5),
statistic: Statistic.SUM,
...opts,
metricName: MetricName.INVALID_TARBALL,
namespace: METRICS_NAMESPACE,
});
} | cdklabs/construct-hub | src/backend/ingestion/index.ts | TypeScript |
MethodDeclaration | /**
* This metrics is the total count of packages that were rejected due to
* mismatched identity (name, version, license) between the `package.json`
* file and te `.jsii` attribute.
*/
public metricMismatchedIdentityRejections(opts?: MetricOptions): Metric {
return new Metric({
period: Duration.m... | cdklabs/construct-hub | src/backend/ingestion/index.ts | TypeScript |
ArrowFunction |
() => {
test('click on closed', () => {
const mockToggle = jest.fn();
const view = mount(
<SelectToggle id="Select Toggle" onToggle={mockToggle} parentRef={{ current: document.createElement('div') }}>
Select
</SelectToggle>
);
view
.find('button')
.first()
.simu... | CooperRedhat/patternfly-react | packages/react-core/src/components/Select/__tests__/SelectToggle.test.tsx | TypeScript |
ArrowFunction |
() => {
const mockToggle = jest.fn();
const view = mount(
<SelectToggle id="Select Toggle" onToggle={mockToggle} parentRef={{ current: document.createElement('div') }} | CooperRedhat/patternfly-react | packages/react-core/src/components/Select/__tests__/SelectToggle.test.tsx | TypeScript |
ArrowFunction |
() => {
const mockToggle = jest.fn();
const view = mount(
<SelectToggle
id="Select Toggle"
onToggle={mockToggle}
isOpen
parentRef={{ current: document.createElement('div') }} | CooperRedhat/patternfly-react | packages/react-core/src/components/Select/__tests__/SelectToggle.test.tsx | TypeScript |
ArrowFunction |
() => {
const map = {} as any;
document.addEventListener = jest.fn((event, cb) => {
map[event] = cb;
});
const mockToggle = jest.fn();
mount(
<SelectToggle
id="Select Toggle"
onToggle={mockToggle}
isOpen
parentRef={{ current: document.createElement('div')... | CooperRedhat/patternfly-react | packages/react-core/src/components/Select/__tests__/SelectToggle.test.tsx | TypeScript |
ArrowFunction |
(event, cb) => {
map[event] = cb;
} | CooperRedhat/patternfly-react | packages/react-core/src/components/Select/__tests__/SelectToggle.test.tsx | TypeScript |
ArrowFunction |
() => {
const map = {} as any;
document.addEventListener = jest.fn((event, cb) => {
map[event] = cb;
});
document.removeEventListener = jest.fn((event, cb) => {
if (map[event] === cb) {
map[event] = () => {};
}
});
const mockToggle = jest.fn();
const view = mount(
... | CooperRedhat/patternfly-react | packages/react-core/src/components/Select/__tests__/SelectToggle.test.tsx | TypeScript |
ArrowFunction |
(event, cb) => {
if (map[event] === cb) {
map[event] = () => {};
}
} | CooperRedhat/patternfly-react | packages/react-core/src/components/Select/__tests__/SelectToggle.test.tsx | TypeScript |
ArrowFunction |
() => {
test('active', () => {
const view = mount(
<SelectToggle id="Select Toggle" isActive parentRef={{ current: document.createElement('div') }}>
Select
</SelectToggle>
);
expect(view).toMatchSnapshot();
} | CooperRedhat/patternfly-react | packages/react-core/src/components/Select/__tests__/SelectToggle.test.tsx | TypeScript |
ArrowFunction |
() => {
const view = mount(
<SelectToggle id="Select Toggle" isActive parentRef={{ current: document.createElement('div') }} | CooperRedhat/patternfly-react | packages/react-core/src/components/Select/__tests__/SelectToggle.test.tsx | TypeScript |
TypeAliasDeclaration |
export type CacheValue = number | Record<string, any>; | HcwXd/bottender | packages/bottender/src/cache/CacheStore.ts | TypeScript |
TypeAliasDeclaration |
type CacheStore = {
get(key: string): Promise<CacheValue | null>;
all(): Promise<CacheValue[]>;
put(key: string, value: CacheValue, minutes: number): Promise<void>;
forget(key: string): Promise<void>;
flush(): Promise<void>;
getPrefix(): string;
}; | HcwXd/bottender | packages/bottender/src/cache/CacheStore.ts | TypeScript |
ClassDeclaration |
@Controller('/api/v1')
export class ApiV1PaymentController {
constructor (
private readonly accountsService: AccountsService
) {}
@UseGuards(UserRequiredAuthGuard)
@Post('add-payment-token')
async handleAddPaymentToken (@Request() req, @Res() res: Response): Promise<any> {
const account = await this... | kompotkot/saasform | src/webapp/src/api/controllers/v1/api.payment.controller.ts | TypeScript |
MethodDeclaration |
@UseGuards(UserRequiredAuthGuard)
@Post('add-payment-token')
async handleAddPaymentToken (@Request() req, @Res() res: Response): Promise<any> {
const account = await this.accountsService.findByOwnerEmail(req.user.email)
if (account == null) {
return res.json({
statusCode: 400,
error:... | kompotkot/saasform | src/webapp/src/api/controllers/v1/api.payment.controller.ts | TypeScript |
ArrowFunction |
() => {
it('should render text when not wrapped with provider', () => {
let App = () => (
<>
<Text>Foobar 3000</Text>
</>
);
let { getByText } = render(<App />);
expect(getByText('Foobar 3000')).toBeTruthy();
} | RuneXa/infra | packages/exoflex/src/components/__tests__/Text.test.web.tsx | TypeScript |
ArrowFunction |
() => {
let App = () => (
<>
<Text>Foobar 3000</Text>
</> | RuneXa/infra | packages/exoflex/src/components/__tests__/Text.test.web.tsx | TypeScript |
ArrowFunction |
() => (
<>
<Text>Foobar | RuneXa/infra | packages/exoflex/src/components/__tests__/Text.test.web.tsx | TypeScript |
ArrowFunction |
() => {
let App = () => (
<Provider skipFontsLoading>
<Text>Foobar 3000</Text>
</Provider> | RuneXa/infra | packages/exoflex/src/components/__tests__/Text.test.web.tsx | TypeScript |
ArrowFunction |
() => (
<Provider skipFontsLoading>
<Text>Foobar | RuneXa/infra | packages/exoflex/src/components/__tests__/Text.test.web.tsx | TypeScript |
ArrowFunction |
(err: Error, raw: Buffer) => {
if (err) return cb(err)
var account = new Account(raw)
cb(null, account)
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
ArrowFunction |
(err: Error, account: Account) => {
if (err) return cb(err)
this._update(key, account, false, false)
cb(null, account)
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
ArrowFunction |
val => {
if (val) accountArr.push(val)
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
ArrowFunction |
(addressHex: string, done: any) => {
var address = Buffer.from(addressHex, 'hex')
this._lookupAccount(address, (err: Error, account: Account) => {
if (err) return done(err)
this._update(address, account, false, false)
done()
})
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
ArrowFunction |
(err: Error, account: Account) => {
if (err) return done(err)
this._update(address, account, false, false)
done()
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
ArrowFunction |
() => next | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
ArrowFunction |
(done: any) => {
if (it.value && it.value.modified) {
it.value.modified = false
it.value.val = it.value.val.serialize()
this._trie.put(Buffer.from(it.key, 'hex'), it.value.val, (err: Error) => {
if (err) return done(err)
next = it.hasNext
it.nex... | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
ArrowFunction |
(err: Error) => {
if (err) return done(err)
next = it.hasNext
it.next()
done()
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
ClassDeclaration | /**
* @ignore
*/
export default class Cache {
_cache: any
_checkpoints: any[]
_trie: any
constructor(trie: any) {
this._cache = Tree()
this._checkpoints = []
this._trie = trie
}
/**
* Puts account to cache under its address.
* @param key - Address of account
* @param val - Account
... | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Puts account to cache under its address.
* @param key - Address of account
* @param val - Account
*/
put(key: Buffer, val: Account, fromTrie: boolean = false): void {
const modified = !fromTrie
this._update(key, val, modified, false)
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Returns the queried account or an empty account.
* @param key - Address of account
*/
get(key: Buffer): Account {
let account = this.lookup(key)
if (!account) {
account = new Account()
}
return account
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Returns the queried account or undefined.
* @param key - Address of account
*/
lookup(key: Buffer): Account | undefined {
const keyStr = key.toString('hex')
const it = this._cache.find(keyStr)
if (it.node) {
const account = new Account(it.value.val)
return account
}
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Looks up address in underlying trie.
* @param address - Address of account
* @param cb - Callback with params (err, account)
*/
_lookupAccount(address: Buffer, cb: any): void {
this._trie.get(address, (err: Error, raw: Buffer) => {
if (err) return cb(err)
var account = new Account(raw)... | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Looks up address in cache, if not found, looks it up
* in the underlying trie.
* @param key - Address of account
* @param cb - Callback with params (err, account)
*/
getOrLoad(key: Buffer, cb: any): void {
const account = this.lookup(key)
if (account) {
asyncLib.nextTick(cb, null, acc... | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Warms cache by loading their respective account from trie
* and putting them in cache.
* @param addresses - Array of addresses
* @param cb - Callback
*/
warm(addresses: string[], cb: any): void {
// shim till async supports iterators
const accountArr: string[] = []
addresses.forEach(val... | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Flushes cache by updating accounts that have been modified
* and removing accounts that have been deleted.
* @param cb - Callback
*/
flush(cb: any): void {
const it = this._cache.begin
let next = true
asyncLib.whilst(
() => next,
(done: any) => {
if (it.value && it.valu... | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Marks current state of cache as checkpoint, which can
* later on be reverted or commited.
*/
checkpoint(): void {
this._checkpoints.push(this._cache)
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Revert changes to cache last checkpoint (no effect on trie).
*/
revert(): void {
this._cache = this._checkpoints.pop()
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Commits to current state of cache (no effect on trie).
*/
commit(): void {
this._checkpoints.pop()
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Clears cache.
*/
clear(): void {
this._cache = Tree()
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
MethodDeclaration | /**
* Marks address as deleted in cache.
* @param key - Address
*/
del(key: Buffer): void {
this._update(key, new Account(), false, true)
} | Aminadav/ethereumjs-vm | lib/state/cache.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.