type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
(): void => { // eslint-disable-next-line @typescript-eslint/no-empty-function beforeEach((): void => {}); test('should return an empty array when handle is undefined', async (): Promise<void> => { // Given const handle: ElementHandle<Element> | undefined = undefined; // When const res...
hdorgeval/playwright-controller
src/actions/handle-actions/get-all-options-of-handle/tests/get-all-options-of-handle.common.test.ts
TypeScript
ArrowFunction
async (): Promise<void> => { // Given const handle: ElementHandle<Element> | undefined = undefined; // When const result = await SUT.getAllOptionsOfHandle(handle, 'foobar'); // Then expect(Array.isArray(result)).toBe(true); expect(result.length).toBe(0); }
hdorgeval/playwright-controller
src/actions/handle-actions/get-all-options-of-handle/tests/get-all-options-of-handle.common.test.ts
TypeScript
ArrowFunction
async (): Promise<void> => { // Given const handle: ElementHandle<Element> | null = null; // When const result = await SUT.getAllOptionsOfHandle(handle, 'foobar'); // Then expect(Array.isArray(result)).toBe(true); expect(result.length).toBe(0); }
hdorgeval/playwright-controller
src/actions/handle-actions/get-all-options-of-handle/tests/get-all-options-of-handle.common.test.ts
TypeScript
ClassDeclaration
export class User { name: string email: string; }
Mihai-Ionut-Aurel/scala-play-angular-authentication
ui/src/app/authentification/_models/user.ts
TypeScript
ArrowFunction
() => uuidv4()
Simon2828/learning-objectives-backend
src/utils/index.ts
TypeScript
ArrowFunction
() => { createRoot(dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; const { stop } = createCompositeEffect(stoppable(counter, x => captured.push(x))); setTimeout(() => { setCounter(1); assert.is(captured[1], 1, "change before stop"); stop...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; const { stop } = createCompositeEffect(stoppable(counter, x => captured.push(x))); setTimeout(() => { setCounter(1); assert.is(captured[1], 1, "change before stop"); stop(); setCounter(...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
x => captured.push(x)
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { setCounter(1); assert.is(captured[1], 1, "change before stop"); stop(); setCounter(2); assert.is(captured[2], undefined, "change after stop"); dispose(); }
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { createRoot(dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; createCompositeEffect( once(counter, x => captured.push(x)), { defer: true } ); setTimeout(() => { setCounter(1); assert.is(captured[0], 1, "first change should...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; createCompositeEffect( once(counter, x => captured.push(x)), { defer: true } ); setTimeout(() => { setCounter(1); assert.is(captured[0], 1, "first change should be captured"); ...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { setCounter(1); assert.is(captured[0], 1, "first change should be captured"); setCounter(2); assert.is(captured[1], undefined, "next change shouldn't be captured"); dispose(); }
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { createRoot(dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; const { count } = createCompositeEffect(atMost(counter, x => captured.push(x), { limit: 2 })); assert.is(count(), 0, "initial count should be 0"); setTimeout(() => { assert.is(co...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; const { count } = createCompositeEffect(atMost(counter, x => captured.push(x), { limit: 2 })); assert.is(count(), 0, "initial count should be 0"); setTimeout(() => { assert.is(count(), 1, "count afte...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { assert.is(count(), 1, "count after initial effect should be 1"); assert.equal(captured, [0], "initial state should be captured"); setCounter(1); assert.is(count(), 2, "count after first change should be 2"); assert.equal(captured, [0, 1], "first change should be captured"); ...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { createRoot(dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; createCompositeEffect(debounce(counter, x => captured.push(x), 10)); setTimeout(() => { assert.equal(captured, [], "initial state should not be captured immediately"); setCount...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; createCompositeEffect(debounce(counter, x => captured.push(x), 10)); setTimeout(() => { assert.equal(captured, [], "initial state should not be captured immediately"); setCounter(1); assert.e...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { assert.equal(captured, [], "initial state should not be captured immediately"); setCounter(1); assert.equal(captured, [], "first change should not be captured immediately"); }
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { assert.equal(captured, [1], "after delay, only the last change should be captured"); setCounter(7); setCounter(9); setTimeout(() => { assert.equal(captured, [1, 9], "after delay, only the next last change should be captured"); dispose(); }, 15); }
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { assert.equal(captured, [1, 9], "after delay, only the next last change should be captured"); dispose(); }
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { createRoot(dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; createCompositeEffect(throttle(counter, x => captured.push(x), 10)); setTimeout(() => { assert.equal(captured, [], "initial state should not be captured immediately"); setCount...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; createCompositeEffect(throttle(counter, x => captured.push(x), 10)); setTimeout(() => { assert.equal(captured, [], "initial state should not be captured immediately"); setCounter(1); assert.e...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { assert.equal(captured, [0], "after delay, only the initial state should be captured"); setCounter(7); setCounter(9); setTimeout(() => { assert.equal( captured, [0, 7], "after delay, only the next first change should be captured" ); d...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { assert.equal( captured, [0, 7], "after delay, only the next first change should be captured" ); dispose(); }
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { createRoot(dispose => { const [counter, setCounter] = createSignal(0); const captured1: number[] = []; const captured2: number[] = []; createCompositeEffect( whenever( () => counter() % 2 === 0, () => captured1.push(counter()) ) ); createCompositeEffect(...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
dispose => { const [counter, setCounter] = createSignal(0); const captured1: number[] = []; const captured2: number[] = []; createCompositeEffect( whenever( () => counter() % 2 === 0, () => captured1.push(counter()) ) ); createCompositeEffect( whenever( ...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => counter() % 2 === 0
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => captured1.push(counter())
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => counter() >= 3
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => captured2.push(counter())
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { assert.equal(captured1, [0], "initial state should be captured for 1"); assert.equal(captured2, [], "initial state should not be captured for 2"); setCounter(1); assert.equal(captured1, [0], "first change should not be captured for 1"); assert.equal(captured2, [], "first change sh...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { createRoot(dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; const { pause, resume, toggle } = createCompositeEffect( pausable(counter, () => captured.push(counter()), { active: false }) ); setTimeout(() => { assert.equal(captured, [...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; const { pause, resume, toggle } = createCompositeEffect( pausable(counter, () => captured.push(counter()), { active: false }) ); setTimeout(() => { assert.equal(captured, [], "initial state sho...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => captured.push(counter())
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { assert.equal(captured, [], "initial state should not be captured"); setCounter(1); assert.equal(captured, [], "first change should not be captured"); resume(); setCounter(2); assert.equal(captured, [2], "after resume() change should be captured"); pause(); setCou...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { createRoot(dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; const { ignoreNext, ignore } = createCompositeEffect( ignorable(counter, x => { captured.push(x); // next effect will be ignored: ignoreNext(); setCounter(...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
dispose => { const [counter, setCounter] = createSignal(0); const captured: number[] = []; const { ignoreNext, ignore } = createCompositeEffect( ignorable(counter, x => { captured.push(x); // next effect will be ignored: ignoreNext(); setCounter(p => p + 1); ...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
x => { captured.push(x); // next effect will be ignored: ignoreNext(); setCounter(p => p + 1); // this change happens in the same effect, so it will also be ignored setCounter(5); }
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
p => p + 1
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { assert.equal(captured, [0], "initial state should be captured"); assert.is(counter(), 5, "although it wasn't captured, the counter should be 5"); ignore(() => { // both changes will be ignored: setCounter(420); setCounter(69); }); assert.equal(captured, [0]...
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
() => { // both changes will be ignored: setCounter(420); setCounter(69); }
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
p => 111
KrofDrakula/solid-primitives
packages/composites/test/modifiers.test.ts
TypeScript
ArrowFunction
(a: TransactionDetails, b: TransactionDetails) => b.addedTime - a.addedTime
CryptoCoder50/BSC-Moonwalker-Swap
src/components/PageHeader/RecentTransactionsModal.tsx
TypeScript
ArrowFunction
(sortedRecentTransaction: TransactionDetails) => { const { hash, receipt } = sortedRecentTransaction if (!hash) { return { icon: <Loader />, color: 'text' } } if (hash && receipt?.status === 1) { return { icon: <CheckmarkCircleIcon color="success" />, color: 'success' } } return { icon: <ErrorIc...
CryptoCoder50/BSC-Moonwalker-Swap
src/components/PageHeader/RecentTransactionsModal.tsx
TypeScript
ArrowFunction
({ onDismiss = defaultOnDismiss, translateString }: RecentTransactionsModalProps) => { const TranslateString = translateString const { account, chainId } = useActiveWeb3React() const allTransactions = useAllTransactions() // Logic taken from Web3Status/index.tsx line 175 const sortedRecentTransactions = use...
CryptoCoder50/BSC-Moonwalker-Swap
src/components/PageHeader/RecentTransactionsModal.tsx
TypeScript
ArrowFunction
() => { const txs = Object.values(allTransactions) return txs.filter(isTransactionRecent).sort(newTransactionsFirst) }
CryptoCoder50/BSC-Moonwalker-Swap
src/components/PageHeader/RecentTransactionsModal.tsx
TypeScript
ArrowFunction
(sortedRecentTransaction) => { const { hash, summary } = sortedRecentTransaction const { icon, color } = getRowStatus(sortedRecentTransaction) return ( <> <Flex key={hash} alignItems="center" justifyContent="space-between" mb="4px"> <LinkExternal...
CryptoCoder50/BSC-Moonwalker-Swap
src/components/PageHeader/RecentTransactionsModal.tsx
TypeScript
TypeAliasDeclaration
type RecentTransactionsModalProps = { onDismiss?: () => void translateString: (translationId: number, fallback: string) => (string) }
CryptoCoder50/BSC-Moonwalker-Swap
src/components/PageHeader/RecentTransactionsModal.tsx
TypeScript
MethodDeclaration
TranslateString(1202, 'Recent transactions')
CryptoCoder50/BSC-Moonwalker-Swap
src/components/PageHeader/RecentTransactionsModal.tsx
TypeScript
ArrowFunction
() => { let component: AccountPickerComponent; let fixture: ComponentFixture<AccountPickerComponent>; let userServiceSpy; beforeEach(async(() => { const subFn = { subscribe: () => {} }; const getValueFn = { getValue: () => {} }; userServiceSpy = jasmine.createSpyObj('UserService', [ 'userAcc...
poliha/wallet.saza.io
src/app/components/account-picker/account-picker.component.spec.ts
TypeScript
ArrowFunction
() => { const subFn = { subscribe: () => {} }; const getValueFn = { getValue: () => {} }; userServiceSpy = jasmine.createSpyObj('UserService', [ 'userAccounts', 'activeAccount', 'setActiveAccount', ]); userServiceSpy.activeAccount = jasmine.createSpyObj('activeAccount', subFn); ...
poliha/wallet.saza.io
src/app/components/account-picker/account-picker.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(AccountPickerComponent); component = fixture.componentInstance; fixture.detectChanges(); }
poliha/wallet.saza.io
src/app/components/account-picker/account-picker.component.spec.ts
TypeScript
InterfaceDeclaration
export interface CredentialStatus { id: string type: string }
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
/** * A JWT payload representation of a Credential * @see https://www.w3.org/TR/vc-data-model/#jwt-encoding */ export interface JwtCredentialPayload { iss?: string sub?: string vc: Extensible<{ '@context': string[] | string type: string[] | string credentialSubject: JwtCredentialSubject credent...
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
/** * A JWT payload representation of a Presentation * @see https://www.w3.org/TR/vc-data-model/#jwt-encoding */ export interface JwtPresentationPayload { vp: Extensible<{ '@context': string[] | string type: string[] | string verifiableCredential?: VerifiableCredential[] | VerifiableCredential }> i...
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
/** * used as input when creating Verifiable Credentials */ interface FixedCredentialPayload { '@context': string | string[] id?: string type: string | string[] issuer: IssuerType issuanceDate: DateType expirationDate?: DateType credentialSubject: Extensible<{ id?: string }> credentialStatus?: C...
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
/** * This is meant to reflect unambiguous types for the properties in `CredentialPayload` */ interface NarrowCredentialDefinitions { '@context': string[] type: string[] issuer: Exclude<IssuerType, string> issuanceDate: string expirationDate?: string }
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
/** * used as input when creating Verifiable Presentations */ export interface FixedPresentationPayload { '@context': string | string[] type: string | string[] id?: string verifiableCredential?: VerifiableCredential[] holder: string verifier?: string | string[] issuanceDate?: string expirationDate?: s...
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
interface NarrowPresentationDefinitions { '@context': string[] type: string[] verifier: string[] verifiableCredential?: Verifiable<W3CCredential>[] }
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
export interface Proof { type?: string // eslint-disable-next-line @typescript-eslint/no-explicit-any [x: string]: any }
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
/** * Represents a tuple of a DID-URL with a `Signer` and associated algorithm. */ export interface Issuer { did: string // eslint-disable-next-line // @ts-ignore signer: Signer alg?: string }
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
/** * Represents the Creation Options that can be passed to the createVerifiableCredentialJwt method. */ export interface CreateCredentialOptions { /** * Determines whether the JSON->JWT transformation will remove the original fields from the input payload. * See https://www.w3.org/TR/vc-data-model/#jwt-encod...
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
/** * Represents the Verification Options that can be passed to the verifyPresentation method. * The verification will fail if given options are NOT satisfied. */ export interface VerifyPresentationOptions extends VerifyCredentialOptions { domain?: string challenge?: string }
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
InterfaceDeclaration
/** * Represents the Creation Options that can be passed to the createVerifiablePresentationJwt method. */ export interface CreatePresentationOptions extends CreateCredentialOptions { domain?: string challenge?: string }
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
// eslint-disable-next-line @typescript-eslint/no-explicit-any export type JwtCredentialSubject = Record<string, any>
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
export type IssuerType = Extensible<{ id: string }> | string
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
export type DateType = string | Date
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * A more flexible representation of a {@link W3CCredential} that can be used as input to methods * that expect it. */ export type CredentialPayload = Extensible<FixedCredentialPayload>
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * Replaces the matching property types of T with the ones in U */ type Replace<T, U> = Omit<T, keyof U> & U
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
// eslint-disable-next-line @typescript-eslint/no-explicit-any type Extensible<T> = T & { [x: string]: any }
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * This data type represents a parsed VerifiableCredential. * It is meant to be an unambiguous representation of the properties of a Credential and is usually the result of a transformation method. * * `issuer` is always an object with an `id` property and potentially other app specific issuer claims * `issuanc...
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * A more flexible representation of a {@link W3CPresentation} that can be used as input to methods * that expect it. */ export type PresentationPayload = Extensible<FixedPresentationPayload>
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * This data type represents a parsed Presentation payload. * It is meant to be an unambiguous representation of the properties of a Presentation and is usually the result of a transformation method. * * The `verifiableCredential` array should contain parsed `Verifiable<Credential>` elements. * Any JWT specific...
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * Represents a readonly representation of a verifiable object, including the {@link Proof} * property that can be used to verify it. */ export type Verifiable<T> = Readonly<T> & { readonly proof: Proof }
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
export type JWT = string
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * A union type for both possible representations of a Credential (JWT and W3C standard) * * @see https://www.w3.org/TR/vc-data-model/#proof-formats */ export type VerifiableCredential = JWT | Verifiable<W3CCredential>
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * A union type for both possible representations of a Presentation (JWT and W3C standard) * * @see https://www.w3.org/TR/vc-data-model/#proof-formats */ export type VerifiablePresentation = JWT | Verifiable<W3CPresentation>
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
// eslint-disable-next-line // @ts-ignore export type VerifiedJWT = JWTVerified
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * Represents the result of a Presentation verification. * It includes the properties produced by `did-jwt` and a W3C compliant representation of * the Presentation that was just verified. * * This is usually the result of a verification method and not meant to be created by generic code. */ export type Verifi...
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * Represents the result of a Credential verification. * It includes the properties produced by `did-jwt` and a W3C compliant representation of * the Credential that was just verified. * * This is usually the result of a verification method and not meant to be created by generic code. */ export type VerifiedCr...
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
TypeAliasDeclaration
/** * Represents the Verification Options that can be passed to the verifyCredential method. * These options are forwarded to the lower level verification code */ // eslint-disable-next-line @typescript-eslint/no-explicit-any export type VerifyCredentialOptions = Record<string, any>
Electronic-Signatures-Industries/did-jwt-vc
src/types.ts
TypeScript
ArrowFunction
(): { activeAddress: string; setActiveAddress: (address: string) => void } => { const [activeAddress, setActiveAddress] = useState<string>(); const web3 = useWeb3(); useEffect(() => web3.onAccountsChanged((accounts) => setActiveAddress(accounts[0])), []); return { activeAddress, setActiveAddress }; }
bperekitko/liquidator
src/ethereum/web3/useActiveAddress.tsx
TypeScript
ArrowFunction
() => web3.onAccountsChanged((accounts) => setActiveAddress(accounts[0]))
bperekitko/liquidator
src/ethereum/web3/useActiveAddress.tsx
TypeScript
ArrowFunction
(accounts) => setActiveAddress(accounts[0])
bperekitko/liquidator
src/ethereum/web3/useActiveAddress.tsx
TypeScript
ArrowFunction
() => ({ getDevice: () => mockDevice })
EarthEngineering/Facetop-Web-App
frontend/controls/sensors/__tests__/sensor_list_test.tsx
TypeScript
ArrowFunction
() => mockDevice
EarthEngineering/Facetop-Web-App
frontend/controls/sensors/__tests__/sensor_list_test.tsx
TypeScript
ArrowFunction
(): SensorListProps => { const pins: Pins = { 50: { mode: 1, value: 500, }, 51: { mode: 0, value: 1, }, 52: { mode: 0, value: 1, }, 53: { mode: 0, value: 0, }, }; const fakeSensor1 = fakeSensor()...
EarthEngineering/Facetop-Web-App
frontend/controls/sensors/__tests__/sensor_list_test.tsx
TypeScript
ArrowFunction
(pin_number: number, pin_mode: 0 | 1) => ({ pin_number, label: `pin${pin_number}`, pin_mode })
EarthEngineering/Facetop-Web-App
frontend/controls/sensors/__tests__/sensor_list_test.tsx
TypeScript
ArrowFunction
() => { const wrapper = mount(<SensorList {...fakeProps()} />); const readSensorBtn = wrapper.find("button"); readSensorBtn.at(0).simulate("click"); expect(mockDevice.readPin).toHaveBeenCalledWith(expectedPayload(51, 0)); readSensorBtn.at(1).simulate("click"); expect(mockDevice.readPin).toHaveB...
EarthEngineering/Facetop-Web-App
frontend/controls/sensors/__tests__/sensor_list_test.tsx
TypeScript
ArrowFunction
() => { const p = fakeProps(); p.disabled = true; const wrapper = mount(<SensorList {...p} />); const readSensorBtn = wrapper.find("button"); readSensorBtn.first().simulate("click"); readSensorBtn.last().simulate("click"); expect(mockDevice.readPin).not.toHaveBeenCalled(); }
EarthEngineering/Facetop-Web-App
frontend/controls/sensors/__tests__/sensor_list_test.tsx
TypeScript
ArrowFunction
() => { const p = fakeProps(); p.pins[50] && (p.pins[50].value = 600); const wrapper = mount(<SensorList {...p} />); expect(wrapper.html()).toContain("margin-left: -3.5rem"); }
EarthEngineering/Facetop-Web-App
frontend/controls/sensors/__tests__/sensor_list_test.tsx
TypeScript
ClassDeclaration
@Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.scss'] }) export class HomeComponent implements OnInit { isLoading: boolean; constructor() {} ngOnInit() { this.isLoading = true; } }
jeanlucmoisan/webfront
src/app/home/home.component.ts
TypeScript
MethodDeclaration
ngOnInit() { this.isLoading = true; }
jeanlucmoisan/webfront
src/app/home/home.component.ts
TypeScript
FunctionDeclaration
export function isMockFunction(fn: any): fn is EnhancedSpy { return typeof fn === 'function' && '__isSpy' in fn && fn.__isSpy }
JoostK/vitest
packages/vitest/src/integrations/jest-mock.ts
TypeScript
FunctionDeclaration
export function spyOn<T, K extends keyof T>( obj: T, method: K, accessType?: 'get' | 'set', ): T[K] extends (...args: infer TArgs) => infer TReturnValue ? JestMockCompat<TArgs, TReturnValue> : JestMockCompat { const dictionary = { get: 'getter', set: 'setter', } as const const objMethod = acces...
JoostK/vitest
packages/vitest/src/integrations/jest-mock.ts
TypeScript
FunctionDeclaration
function enhanceSpy<TArgs extends any[], TReturns>( spy: SpyImpl<TArgs, TReturns>, ): JestMockCompat<TArgs, TReturns> { const stub = spy as unknown as EnhancedSpy<TArgs, TReturns> let implementation: ((...args: TArgs) => TReturns) | undefined const instances: any[] = [] const mockContext = { get calls...
JoostK/vitest
packages/vitest/src/integrations/jest-mock.ts
TypeScript
FunctionDeclaration
export function fn<TArgs extends any[] = any[], R = any>(): JestMockCompatFn<TArgs, R>
JoostK/vitest
packages/vitest/src/integrations/jest-mock.ts
TypeScript
FunctionDeclaration
export function fn<TArgs extends any[] = any[], R = any>( implementation: (...args: TArgs) => R ): JestMockCompatFn<TArgs, R>
JoostK/vitest
packages/vitest/src/integrations/jest-mock.ts
TypeScript
FunctionDeclaration
export function fn<TArgs extends any[] = any[], R = any>( implementation?: (...args: TArgs) => R, ): JestMockCompatFn<TArgs, R> { return enhanceSpy(tinyspy.spyOn({ fn: implementation || (() => {}) }, 'fn')) as unknown as JestMockCompatFn }
JoostK/vitest
packages/vitest/src/integrations/jest-mock.ts
TypeScript
ArrowFunction
([callType, value]) => { const type = callType === 'error' ? 'throw' : 'return' return { type, value } }
JoostK/vitest
packages/vitest/src/integrations/jest-mock.ts
TypeScript