type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
() => { const {popoverActive, navigableOptions} = this.state; !popoverActive && navigableOptions && navigableOptions.length > 0 && this.setState({popoverActive: true, popoverWasActive: true}); }
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
ArrowFunction
() => { const {selectedIndex, navigableOptions} = this.state; if (!navigableOptions || navigableOptions.length === 0) { return; } let newIndex = selectedIndex; if (selectedIndex + 1 >= navigableOptions.length) { newIndex = 0; } else { newIndex++; } this.selectOptio...
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
ArrowFunction
() => { const {selectedIndex, navigableOptions} = this.state; if (!navigableOptions || navigableOptions.length === 0) { return; } let newIndex = selectedIndex; if (selectedIndex <= 0) { newIndex = navigableOptions.length - 1; } else { newIndex--; } this.selectOptio...
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
ArrowFunction
(newOptionIndex: number) => { const {navigableOptions, selectedOption: oldSelectedOption} = this.state; if (!navigableOptions || navigableOptions.length === 0) { return; } const newSelectedOption = navigableOptions[newOptionIndex]; this.setState( { selectedOption: newSelectedOp...
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
ArrowFunction
() => { this.visuallyUpdateSelectedOption(newSelectedOption, oldSelectedOption); }
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
ArrowFunction
( newOption: OptionDescriptor | ActionListItemDescriptor, oldOption: OptionDescriptor | ActionListItemDescriptor | undefined, ) => { if (oldOption) { oldOption.active = false; } if (newOption) { newOption.active = true; } }
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
ArrowFunction
( option: OptionDescriptor | ActionListItemDescriptor, optionIndex: number, ) => { option.id = `${comboBoxId}-${optionIndex}`; }
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
ArrowFunction
(firstItem: OptionDescriptor | ActionListItemDescriptor, index: number) => { const secondItem = secondOptions[index]; if (isOption(firstItem)) { if (isOption(secondItem)) { return firstItem.value === secondItem.value; } return false; } else { if (!isOption(se...
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
ArrowFunction
(item) => isOption(item)
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
InterfaceDeclaration
export interface State { comboBoxId: string; selectedOption?: OptionDescriptor | ActionListItemDescriptor | undefined; selectedIndex: number; selectedOptions: string[]; navigableOptions: (OptionDescriptor | ActionListItemDescriptor)[]; popoverActive: boolean; popoverWasActive: boolean; }
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
InterfaceDeclaration
export interface Props { /** A unique identifier for the ComboBox */ id?: string; /** Collection of options to be listed */ options: OptionDescriptor[]; /** The selected options */ selected: string[]; /** The text field component attached to the list of options */ textField: React.ReactElement<any>; ...
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
InterfaceDeclaration
export interface Context { comboBoxId: string; selectedOptionId?: string; subscribe(callback: () => void): void; unsubscribe(callback: () => void): void; }
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
MethodDeclaration
static getDerivedStateFromProps( { options: nextOptions, selected: nextSelected, actionsBefore: nextActionsBefore, actionsAfter: nextActionsAfter, }: Props, {navigableOptions, selectedOptions, comboBoxId}: State, ) { const optionsChanged = filterForOptions(navigableOptio...
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
MethodDeclaration
getChildContext(): Context { return { comboBoxId: this.state.comboBoxId, selectedOptionId: this.selectedOptionId, subscribe: this.subscribe, unsubscribe: this.unsubscribe, }; }
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
MethodDeclaration
componentDidMount() { const {options, actionsBefore, actionsAfter} = this.props; const comboBoxId = this.getComboBoxId(); let navigableOptions: (OptionDescriptor | ActionListItemDescriptor)[] = []; if (actionsBefore) { navigableOptions = navigableOptions.concat(actionsBefore); } if (opti...
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
MethodDeclaration
componentDidUpdate(_: Props, prevState: State) { const {contentBefore, contentAfter, emptyState} = this.props; const {navigableOptions, popoverWasActive} = this.state; this.subscriptions.forEach((subscriberCallback) => subscriberCallback()); const optionsChanged = navigableOptions && prevS...
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
MethodDeclaration
getComboBoxId(): string { if (this.state && this.state.comboBoxId) { return this.state.comboBoxId; } return this.props.id || getUniqueId(); }
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
MethodDeclaration
render() { const { options, textField, listTitle, allowMultiple, preferredPosition, actionsBefore, actionsAfter, contentBefore, contentAfter, onEndReached, emptyState, } = this.props; const actionsBeforeMarkup = actionsBefore && actio...
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
MethodDeclaration
filterForOptions(this
Amit-A/polaris-react
src/components/Autocomplete/components/ComboBox/ComboBox.tsx
TypeScript
ClassDeclaration
@Module({ imports: [TodoModule], controllers: [AppController], providers: [AppService], }) export class AppModule {}
alvalle09/NestJS_Todo
src/app.module.ts
TypeScript
FunctionDeclaration
async function updateEpoch() { const e = epochformattedRemaining(); setEstimatedEpoch(parseInt(e.split('-')[0], 10)); setNextEpochIn(e.split('-')[1]); }
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
ArrowFunction
() => { const f = async () => { const poolLP = await getPoolLPAddress(); const poolBonding = await getPoolBondingAddress(); const [ spot, twap, supply, bondedLiquidity, stagedLiquidity, lpBonded, lpStaged, daoBonded, daoStag...
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
ArrowFunction
async () => { const poolLP = await getPoolLPAddress(); const poolBonding = await getPoolBondingAddress(); const [ spot, twap, supply, bondedLiquidity, stagedLiquidity, lpBonded, lpStaged, daoBonded, daoStaged, bondingBon...
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
ArrowFunction
async () => { if (!user) return; const poolLP = await getPoolLPAddress(); const [ userQSDBal, userUniBal, userLpBonded, userLpStaged, userDaoBonded, userDaoStaged, walletLiquidity, stagedLiquidity, bondedLiquidity, ] = aw...
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
ArrowFunction
(a: BigNumber): number => { return parseFloat(formatBN(a, 2).split(',').join('')); }
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
ArrowFunction
(props) => ( <Section style={
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
ArrowFunction
() => { advance(QSDS.addr); }
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
ArrowFunction
({ title, children }) => ( <div> <div style={
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
InterfaceDeclaration
interface InfoBoxProps extends React.ComponentProps<'div'> { title: string; }
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
MethodDeclaration
formatBN(treasuryQSDAmount, 2)
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
MethodDeclaration
formatBN(userQsdBal, 2)
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
MethodDeclaration
formatBN(userDaoStaged, 2)
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
MethodDeclaration
formatBN(userDaoBonded, 2)
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
MethodDeclaration
formatBN(userUniBal, 2)
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
MethodDeclaration
formatBN(userLpStaged, 2)
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
MethodDeclaration
formatBN(userLpBonded, 2)
qsd-finance/dashboard
src/components/Tools/index.tsx
TypeScript
FunctionDeclaration
export function TranslateServiceNgSummary():any[] { return [{summaryKind:3,type:{reference:i0.TranslateService,diDeps:[{isAttribute:false, isHost:false,isSelf:false,isSkipSelf:false,isOptional:false,token:{identifier:{reference:i1.TranslateStore}}}, {isAttribute:false,isHost:false,isSelf:false,isSkipSelf...
jimmybillings/test2
dist/tmp/node_modules/@ngx-translate/core/src/translate.service.ngsummary.ts
TypeScript
FunctionDeclaration
async function runMigrations( db: IDatabase, oldVersion: number, newVersion: number, t: IDatabaseTransaction, ): Promise<void> { await testStore.put('oldVersion', oldVersion, t) await testStore.put('newVersion', newVersion, t) }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.close() }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { async function runMigrations( db: IDatabase, oldVersion: number, newVersion: number, t: IDatabaseTransaction, ): Promise<void> { await testStore.put('oldVersion', oldVersion, t) await testStore.put('newVersion', newVersion, t) } await db.open({ upgrade...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { interface EmptySchema extends DatabaseSchema { key: string value: number } const store = db.addStore<EmptySchema>({ version: 8, name: 'Nested', keyEncoding: new StringEncoding(), valueEncoding: new JsonEncoding<number>(), upgrade: async ( db:...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async ( db: IDatabase, oldVersion: number, newVersion: number, t: IDatabaseTransaction, ): Promise<void> => { await store.put('oldVersion', oldVersion, t) await store.put('newVersion', newVersion, t) }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const foo = { hash: 'hello', name: 'ironfish' } const fooHash = Buffer.from(JSON.stringify(foo)) await fooStore.put('hello', foo) await barStore.put('hello', fooHash) await bazStore.put(fooHash, 'hello') expect(await fooStore.get('hello')).toMatchObject(foo) ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const foo = { hash: 'hello', name: 'ironfish' } const fooHash = Buffer.from(JSON.stringify(foo)) await fooStore.put('hello', foo) await barStore.put('hello', fooHash) expect(await fooStore.get('hello')).toMatchObject(foo) expect(await barStore.get('hello')).t...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await db.metaStore.clear() await db.metaStore.add('a', 1) await expect(db.metaStore.get('a')).resolves.toBe(1) await expect(db.metaStore.add('a', 2)).rejects.toThrow(DuplicateKeyError) await expect(db.metaStore.get('a')).resolves.toBe(1) }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await db.metaStore.clear() await db.transaction([db.metaStore], 'readwrite', async (tx) => { // db=undefined, tx=1 await db.metaStore.add('a', 1, tx) await expect(db.metaStore.get('a', tx)).resolves.toBe(1) // db=undefined, tx=2 await expect(db....
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (tx) => { // db=undefined, tx=1 await db.metaStore.add('a', 1, tx) await expect(db.metaStore.get('a', tx)).resolves.toBe(1) // db=undefined, tx=2 await expect(db.metaStore.add('a', 2, tx)).rejects.toThrow(DuplicateKeyError) await expect(db.metaStore.get('a', tx)).resolves.toB...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await arrayKeyStore.put(['jason', 5, false], true) expect(await arrayKeyStore.get(['jason', 5, false])).toBe(true) expect(await arrayKeyStore.get(['jason', 5, true])).toBe(undefined) await arrayKeyStore.del(['jason', 5, false]) expect(await arrayKeyStore.get(['jas...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { interface NestedSchema extends DatabaseSchema { key: string value: { buffer: Buffer } } const store = db.addStore<NestedSchema>({ version: 1, name: 'Nested', keyEncoding: new StringEncoding(), valueEncoding: new JsonEncoding<{ buffer: Buffer ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
() => { it('should batch array of writes', async () => { await db.open() const foo = { hash: 'hello', name: 'ironfish' } const fooHash = Buffer.from(JSON.stringify(foo)) await db.batch([ [fooStore, 'hello', foo], [barStore, 'hello', fooHash], [bazStore, fooHash, 'h...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const foo = { hash: 'hello', name: 'ironfish' } const fooHash = Buffer.from(JSON.stringify(foo)) await db.batch([ [fooStore, 'hello', foo], [barStore, 'hello', fooHash], [bazStore, fooHash, 'hello'], ]) expect(await fooStore.g...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const foo = { hash: 'hello', name: 'ironfish' } const fooHash = Buffer.from(JSON.stringify(foo)) await db .batch() .put(fooStore, 'hello', foo) .put(barStore, 'hello', fooHash) .put(bazStore, fooHash, 'hello') .commit() ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
() => { it('should write in transaction manually', async () => { await db.open() const foo = { hash: 'hello', name: 'ironfish' } const fooHash = Buffer.from(JSON.stringify(foo)) let transaction = db.transaction([fooStore, barStore, bazStore], 'readwrite') await fooStore.put('hello',...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const foo = { hash: 'hello', name: 'ironfish' } const fooHash = Buffer.from(JSON.stringify(foo)) let transaction = db.transaction([fooStore, barStore, bazStore], 'readwrite') await fooStore.put('hello', foo, transaction) await barStore.put('hello', fo...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const foo = { hash: 'hello', name: 'ironfish' } const fooHash = Buffer.from(JSON.stringify(foo)) await expect(() => db.transaction<void>( [fooStore, barStore, bazStore], 'readwrite', async (transaction) => { await...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
() => db.transaction<void>( [fooStore, barStore, bazStore], 'readwrite', async (transaction) => { await fooStore.put('hello', foo, transaction) await barStore.put('hello', fooHash, transaction) await bazStore.put(fooHash, 'hello', transaction) ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (transaction) => { await fooStore.put('hello', foo, transaction) await barStore.put('hello', fooHash, transaction) await bazStore.put(fooHash, 'hello', transaction) throw new Error('Aborted Transaction!') }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (transaction) => { await fooStore.put('hello', foo, transaction) await barStore.put('hello', fooHash, transaction) await bazStore.put(fooHash, 'hello', transaction) }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (transaction) => { await fooStore.del('hello', transaction) await barStore.del('hello', transaction) await bazStore.del(fooHash, transaction) // Should not be commited until this function returns expect(await fooStore.get('hello')).toMatchObject(foo) e...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const foo = { hash: 'hello', name: 'ironfish' } const bar = { hash: 'hello', name: 'world' } // With an automatic transaction await db.transaction<void>([fooStore], 'readwrite', async (transaction) => { await fooStore.put('cache', bar) await...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (transaction) => { await fooStore.put('cache', bar) await fooStore.del('cache', transaction) expect(await fooStore.get('cache', transaction)).toBeUndefined() expect(await fooStore.get('cache')).toMatchObject(bar) await fooStore.put('cache', foo, transaction) exp...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await db.metaStore.clear() await db.transaction([db.metaStore], 'readwrite', async (tx) => { // db=undefined, tx=undefined expect(await db.metaStore.get('a', tx)).toBeUndefined() // db=1, tx=undefined await db.metaStore.put('a', 1) ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (tx) => { // db=undefined, tx=undefined expect(await db.metaStore.get('a', tx)).toBeUndefined() // db=1, tx=undefined await db.metaStore.put('a', 1) expect(await db.metaStore.get('a', tx)).toBeUndefined() // db=1, tx=1 await db.metaStore.put('a', 1, tx) ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
() => { it('should commit transaction', async () => { await db.open() await db.metaStore.put('test', 0) await db.withTransaction(null, [db.metaStore], 'readwrite', async (transaction) => { await db.metaStore.put('test', 1, transaction) expect(await db.metaStore.get('test')).toBe(...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await db.metaStore.put('test', 0) await db.withTransaction(null, [db.metaStore], 'readwrite', async (transaction) => { await db.metaStore.put('test', 1, transaction) expect(await db.metaStore.get('test')).toBe(0) }) expect(await db.metaStore...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (transaction) => { await db.metaStore.put('test', 1, transaction) expect(await db.metaStore.get('test')).toBe(0) }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await db.metaStore.put('test', 0) await expect( db.withTransaction(null, [db.metaStore], 'readwrite', async (transaction) => { await db.metaStore.put('test', 1, transaction) throw new Error('test') }), ).rejects.toThrowError('te...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (transaction) => { await db.metaStore.put('test', 1, transaction) throw new Error('test') }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await db.metaStore.put('test', 0) await db.withTransaction(null, [db.metaStore], 'readwrite', async (transaction) => { await db.metaStore.put('test', 1, transaction) await transaction.abort() }) expect(await db.metaStore.get('test')).toBe(0)...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (transaction) => { await db.metaStore.put('test', 1, transaction) await transaction.abort() }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await db.metaStore.put('test', 0) const transaction = db.transaction([db.metaStore], 'readwrite') await db.withTransaction( transaction, [db.metaStore], 'readwrite', async (transaction) => { await db.metaStore.put('test', ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (transaction) => { await db.metaStore.put('test', 1, transaction) await db.withTransaction( transaction, [db.metaStore], 'readwrite', async (transaction) => { await db.metaStore.put('test', 2, transaction) }, ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (transaction) => { await db.metaStore.put('test', 2, transaction) }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
() => { it('should create key from value', async () => { await db.open() const foo = { hash: 'keypath', name: '' } await fooStore.put(foo) expect(await fooStore.get('keypath')).toMatchObject(foo) }) it('should create array key from value', async () => { await db.open() ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const foo = { hash: 'keypath', name: '' } await fooStore.put(foo) expect(await fooStore.get('keypath')).toMatchObject(foo) }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const value = { a: '', b: 3, c: true } await keypathStore.put(value) expect(await keypathStore.get(['', 3, true])).toMatchObject(value) }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const key = ['key', 3, true] as SchemaKey<KeypathSchema> const value = { a: 'key', b: 3, c: true } await db.transaction([keypathStore], 'readwrite', async (t) => { await keypathStore.put(value, t) expect(await keypathStore.get(key)).toBeUndefined(...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (t) => { await keypathStore.put(value, t) expect(await keypathStore.get(key)).toBeUndefined() }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
() => { it('should get all keys', async () => { await db.open() await db.metaStore.clear() await db.metaStore.put('a', 1000) await db.metaStore.put('b', 1001) await db.metaStore.put('c', 1002) await db.metaStore.put('d', 1003) const values = await db.metaStore.getAllValue...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await db.metaStore.clear() await db.metaStore.put('a', 1000) await db.metaStore.put('b', 1001) await db.metaStore.put('c', 1002) await db.metaStore.put('d', 1003) const values = await db.metaStore.getAllValues() expect(values).toHaveLength...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await bazStore.clear() const hash = Buffer.from([0x54, 0x57, 0xf6, 0x2c]) // in a transaction await db.transaction([bazStore], 'readwrite', async (tx) => { await bazStore.add(hash, 'VALUE', tx) const keys = await bazStore.getAllKeys(tx) ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (tx) => { await bazStore.add(hash, 'VALUE', tx) const keys = await bazStore.getAllKeys(tx) expect(keys.length).toBe(1) expect(keys[0]?.equals(hash)).toBe(true) }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await db.metaStore.clear() await db.transaction([db.metaStore], 'readwrite', async (tx) => { // a, db=1000, tx=undefined await db.metaStore.put('a', 1000) let values = await db.metaStore.getAllValues(tx) expect(values).toHaveLength(1) ...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (tx) => { // a, db=1000, tx=undefined await db.metaStore.put('a', 1000) let values = await db.metaStore.getAllValues(tx) expect(values).toHaveLength(1) expect(values).toContain(1000) // a, db=1000, tx=1001 await db.metaStore.put('a', 1001, tx) valu...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await db.metaStore.clear() await db.metaStore.put('a', 1) await db.transaction([db.metaStore], 'readwrite', async (tx) => { expect(await db.metaStore.get('a', tx)).toBe(1) let values = await db.metaStore.getAllValues(tx) expect(values).toH...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async (tx) => { expect(await db.metaStore.get('a', tx)).toBe(1) let values = await db.metaStore.getAllValues(tx) expect(values).toHaveLength(1) expect(values).toContain(1) // cache has undefined and should not yield await db.metaStore.del('a', tx) values = awa...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() await bazStore.clear() await bazStore.put(Buffer.alloc(100, 0xff), '1') expect((await bazStore.getAllKeys()).length).toBe(1) }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
ArrowFunction
async () => { await db.open() const keyStore = testPrefixKeyStore as LevelupStore<BazSchema> await keyStore.clear() // Increment the prefix buffer by one expect(keyStore.prefixBuffer).toEqual(Buffer.from([92, 188, 18, 188])) keyStore.prefixBuffer[keyStore.prefixBuffer.length - 1]++...
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
InterfaceDeclaration
interface FooSchema extends DatabaseSchema { key: string value: FooValue }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
InterfaceDeclaration
interface BarSchema extends DatabaseSchema { key: string value: Buffer }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
InterfaceDeclaration
interface BazSchema extends DatabaseSchema { key: Buffer value: string }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
InterfaceDeclaration
interface TestSchema extends DatabaseSchema { key: string value: IJsonSerializable }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
InterfaceDeclaration
interface ArrayKeySchema extends DatabaseSchema { key: [string, number, boolean] value: boolean }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
InterfaceDeclaration
interface KeypathSchema extends DatabaseSchema { key: [string, number, boolean] value: { a: string; b: number; c: boolean } }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
InterfaceDeclaration
interface EmptySchema extends DatabaseSchema { key: string value: number }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
InterfaceDeclaration
interface NestedSchema extends DatabaseSchema { key: string value: { buffer: Buffer } }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
TypeAliasDeclaration
type FooValue = { hash: string name: string }
Hayai-XxX/ironfish
ironfish/src/storage/database.test.ts
TypeScript
FunctionDeclaration
export function requireSearchRaw<T>(relativeTo: string, paths: string[]): T | null { const testPaths = paths .concat(paths.map((mapPath) => path.resolve(relativeTo, mapPath))) .concat(paths.map((mapPath) => path.resolve(relativeTo, 'node_modules', mapPath))); d('searching', testPaths, 'relative to', relati...
Brli/electron-forge
packages/api/core/src/util/require-search.ts
TypeScript
ArrowFunction
(mapPath) => path.resolve(relativeTo, mapPath)
Brli/electron-forge
packages/api/core/src/util/require-search.ts
TypeScript
ArrowFunction
(mapPath) => path.resolve(relativeTo, 'node_modules', mapPath)
Brli/electron-forge
packages/api/core/src/util/require-search.ts
TypeScript