type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
async (data, state) => { if (data.key === SYMBOLS[0]) { return Promise.resolve([bind("DotPressed")]); } if (data.key === SYMBOLS[1]) { // let's say this is an invalid operation if there is no operator in the model if (!state.operator) throw Error("Don't have an operator!"); return P...
Rotorsoft/eventually-monorepo
services/calculator/src/calculator.aggregate.ts
TypeScript
ArrowFunction
async () => Promise.resolve([bind("Cleared"), bind("Ignored3"), bind("Cleared")])
Rotorsoft/eventually-monorepo
services/calculator/src/calculator.aggregate.ts
TypeScript
ClassDeclaration
export class TableCell extends React.Component<TableCellProps> { @boundMethod onClick(evt: React.MouseEvent<HTMLDivElement>) { if (this.props.onClick) { this.props.onClick(evt); } if (this.isSortable) { this.props._sort(this.props.sortBy); } } get isSortable() { const { _sorti...
KorvinSzanto/lens
src/renderer/components/table/table-cell.tsx
TypeScript
InterfaceDeclaration
export interface TableCellProps extends React.DOMAttributes<HTMLDivElement> { id?: string; // used for configuration visibility of columns className?: string; title?: ReactNode; checkbox?: boolean; // render cell with a checkbox isChecked?: boolean; // mark checkbox as checked or not renderBoolean?: boolea...
KorvinSzanto/lens
src/renderer/components/table/table-cell.tsx
TypeScript
TypeAliasDeclaration
export type TableCellElem = React.ReactElement<TableCellProps>;
KorvinSzanto/lens
src/renderer/components/table/table-cell.tsx
TypeScript
MethodDeclaration
@boundMethod onClick(evt: React.MouseEvent<HTMLDivElement>) { if (this.props.onClick) { this.props.onClick(evt); } if (this.isSortable) { this.props._sort(this.props.sortBy); } }
KorvinSzanto/lens
src/renderer/components/table/table-cell.tsx
TypeScript
MethodDeclaration
renderSortIcon() { const { sortBy, _sorting } = this.props; if (!this.isSortable) return null; const sortActive = _sorting.sortBy === sortBy; const sortIconName = (!sortActive || _sorting.orderBy === "desc") ? "arrow_drop_down" : "arrow_drop_up"; return ( <Icon className={cssNames("...
KorvinSzanto/lens
src/renderer/components/table/table-cell.tsx
TypeScript
MethodDeclaration
cssNames("sortIcon", { enabled: sortActive })
KorvinSzanto/lens
src/renderer/components/table/table-cell.tsx
TypeScript
MethodDeclaration
renderCheckbox() { const { checkbox, isChecked } = this.props; const showCheckbox = isChecked !== undefined; if (checkbox && showCheckbox) { return <Checkbox value={isChecked} />; } return null; }
KorvinSzanto/lens
src/renderer/components/table/table-cell.tsx
TypeScript
MethodDeclaration
render() { const { className, checkbox, isChecked, sortBy, _sort, _sorting, _nowrap, children, title, renderBoolean: displayBoolean, showWithColumn, ...cellProps } = this.props; const classNames = cssNames("TableCell", className, { checkbox, nowrap: _nowrap, sorting: this.isSortable, }); ...
KorvinSzanto/lens
src/renderer/components/table/table-cell.tsx
TypeScript
ClassDeclaration
export class Inputs { @observable @input move?: MoveT; @observable @input tips?: TipT[]; @observable @input userProfile?: UserProfileT; }
mnieber/lindyscience
frontend/src/tips/TipsState/facets/Inputs.ts
TypeScript
ArrowFunction
({ swap, index }: { swap: EnrichedSwap; index: number }) => { const dispatch = useSwapsDispatch(); const ReadyComponent = () => { const time = useSwapExpire(swap.decodedInvoice?.expires_at); return ( <S.row> <DarkSubTitle>{`Id: ${swap.id}`}</DarkSubTitle> <S.single> <S.read...
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
() => { const time = useSwapExpire(swap.decodedInvoice?.expires_at); return ( <S.row> <DarkSubTitle>{`Id: ${swap.id}`}
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
() => ( <S.row> <DarkSubTitle>{`Id: ${swap.id}`
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
=> dispatch({ type: 'claim', claim: index, claimType: MEMPOOL, claimTransaction: swap.boltz?.transaction?.hex || '', })
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
() => { const { swaps, open, claim } = useSwapsState(); const dispatch = useSwapsDispatch(); const [enriched, setEnriched] = useState<EnrichedSwap[]>([]); const [getStatus, { data, loading }] = useGetBoltzSwapStatusLazyQuery({ pollInterval: 2000, fetchPolicy: 'network-only', }); useEffect(() => ...
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
() => { if (swaps.length) { getStatus({ variables: { ids: swaps.map((s: { id: string }) => s.id).filter(Boolean), }, }); } }
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
(s: { id: string }) => s.id
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
() => { if (loading || !data?.getBoltzSwapStatus) return; const swapsWithState: EnrichedSwap[] = swaps.map(swap => { const status = data.getBoltzSwapStatus.find(s => s?.id === swap.id); const enriched = { ...swap, boltz: status?.boltz }; return enriched; }); setEnriched(swapsWithSta...
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
swap => { const status = data.getBoltzSwapStatus.find(s => s?.id === swap.id); const enriched = { ...swap, boltz: status?.boltz }; return enriched; }
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
s => s?.id === swap.id
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
() => { const cleaned = enriched.filter(s => { if (!s.boltz?.status) return true; const status = s.boltz.status; if (status === SETTLED || status === REFUNDED || status === EXPIRED) { return false; } return true; }); dispatch({ type: 'cleanup', swaps: cleaned }); }
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
s => { if (!s.boltz?.status) return true; const status = s.boltz.status; if (status === SETTLED || status === REFUNDED || status === EXPIRED) { return false; } return true; }
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ArrowFunction
(swap, index) => ( <Fragment key={`${swap?.id}-${index}`
abhiShandy/thunderhub
src/views/swap/SwapStatus.tsx
TypeScript
ClassDeclaration
export class RateLimiter { #contexts = new Map<string, number>(); isRateLimited(rlc: RateLimitContext, level: Level): boolean { const context = rlc.getContext(level); const contextState: number | undefined = this.#contexts.get(context); if (contextState === undefined) { // First visit for this ...
cknight/logGear
logger/rateLimitContext.ts
TypeScript
ClassDeclaration
export class RateLimitContext { readonly amount: number; readonly unit: TimeUnit | undefined; readonly context: string | undefined; constructor(amount: number, unit?: TimeUnit, context?: string) { this.amount = amount; this.unit = unit; this.context = context; } getContext(level: Level): stri...
cknight/logGear
logger/rateLimitContext.ts
TypeScript
MethodDeclaration
isRateLimited(rlc: RateLimitContext, level: Level): boolean { const context = rlc.getContext(level); const contextState: number | undefined = this.#contexts.get(context); if (contextState === undefined) { // First visit for this context if (rlc.unit) { // atMostEvery this.#cont...
cknight/logGear
logger/rateLimitContext.ts
TypeScript
MethodDeclaration
protected getContexts(): Map<string, number> { return this.#contexts; }
cknight/logGear
logger/rateLimitContext.ts
TypeScript
MethodDeclaration
getContext(level: Level): string { return "" + this.amount + (this.unit ? "." + this.unit.getMilliseconds() : "") + (this.context ? "." + this.context : "") + "." + level; }
cknight/logGear
logger/rateLimitContext.ts
TypeScript
InterfaceDeclaration
export interface ItemState { label: string | number, icon: string, disabled: boolean, labelRenderer: null | ((data: { label: string | number }) => any) }
qmhc/vexip-ui
components/tabs/symbol.ts
TypeScript
InterfaceDeclaration
export interface TabsState { currentActive: string | number, increaseItem: (item: ItemState) => void, decreaseItem: (item: ItemState) => void, handleActive: (label: string | number) => void, refreshLabels: () => void }
qmhc/vexip-ui
components/tabs/symbol.ts
TypeScript
ArrowFunction
index => { if (index >= 0) { const tabName = this.store.cdump.nodes[index].name; console.log('tab name:', tabName); if ( tabName.toLowerCase().includes('map') || tabName.toLowerCase().includes('highlandpark') || tabName.toLowerCase().includes('hp') ) ...
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
ArrowFunction
item => { if ( !( item.hasOwnProperty('constraints') && item.value !== undefined && !item.value.includes('get_input') ) ) { return item; } }
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
ArrowFunction
response => { console.log('generateMappingRulesFileName response: ', response); this.store.advancedSetting.forEach(element => { if (response.includes(element.name)) { element.isExist = true; } else { element.isExist = false...
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
ArrowFunction
element => { if (response.includes(element.name)) { element.isExist = true; } else { element.isExist = false; } }
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
ArrowFunction
x => x.version === version
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
ArrowFunction
x => x.eventTypes
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
ArrowFunction
tree => { console.log('tree: ', tree); this.loader = false; this.nodesUpdated.emit({ nodes: tree }); }
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-version-type-select', templateUrl: './version-type-select.component.html', styleUrls: ['./version-type-select.component.scss'] }) export class VersionTypeSelectComponent { mappingTarget: string; selectedEvent: String; selectedVersion: String; events: Array<String>; loader: b...
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
MethodDeclaration
changeNotifyId() { if (!this.notifyIdCheckbox) { this.store.notifyIdValue = ''; } return (this.notifyIdCheckbox = !this.notifyIdCheckbox); }
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
MethodDeclaration
onChangeMapping(configurationKey) { console.log('changing propertiy key:', configurationKey); this._ruleApi.setFieldName(configurationKey); this.refrashRuleList.next(); }
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
MethodDeclaration
updateData(version, eventType, isList) { this.selectedVersion = version; this.selectedEvent = eventType; this.readOnly = true; }
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
MethodDeclaration
updateVersionTypeFlag(flag) { this.readOnly = flag; if (flag === false) { this.selectedVersion = null; this.selectedEvent = null; } }
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
MethodDeclaration
onSelectVersion(version, eventType) { if (typeof eventType === 'undefined') { this.selectedEvent = ''; this.events = this.metaData .filter(x => x.version === version) .map(x => x.eventTypes)[0]; if (eventType) { this.editMode = true; this.selectedEvent = eventType ...
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
MethodDeclaration
onSelectEventType(eventType) { this.loader = true; this._ruleApi .getSchema(this.selectedVersion, this.selectedEvent) .subscribe(tree => { console.log('tree: ', tree); this.loader = false; this.nodesUpdated.emit({ nodes: tree }); }); }
onap/archive-sdc-dcae-d-fe
public/src/app/rule-engine/version-type-select/version-type-select.component.ts
TypeScript
ClassDeclaration
@NgModule({ imports: [ RouterModule.forChild(routes), SharedDocumentationPageModule, PlatformCheckboxModule, PlatformFormGeneratorModule, FdpFormGroupModule, PlatformButtonModule, PlatformSliderModule, BusyIndicatorModule ], exports: [RouterMo...
I518192/fundamental-ngx
apps/docs/src/app/platform/component-docs/platform-forms/platform-form-generator/platform-form-generator-docs.module.ts
TypeScript
InterfaceDeclaration
interface IProduct { name: string; price: number; }
MrFrontend/TypeScript-CherryPickPorto
demo2/app/models/IProduct.ts
TypeScript
FunctionDeclaration
function TreasuryDashboard() { const { t } = useTranslation(); const tooltipItems = useMemo( () => ({ tvl: [t('dashboard.tooltipItems.tvl')], apy: [t('common.180Chest'), t('common.90Chest'), t('common.28Chest'), t('common.14Chest'), t('common.staking')], runway: [ t('dashboard.toolti...
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
p => p.stopColor
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
([color1, color2]) => ({ background: `linear-gradient(180deg, ${color1} 19%, ${color2} 100%)`, })
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
theme => ({ btngrp: { '&': { backgroundColor: theme.palette.mode.lightGray300, }, }, btn: { '&': { borderRadius: '0.3rem !important', height: '1.4rem', marginTop: '4%', color: theme.palette.primary.main, }, '&.Mui-selected': { color: theme.palette.primary....
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
() => ({ tvl: [t('dashboard.tooltipItems.tvl')], apy: [t('common.180Chest'), t('common.90Chest'), t('common.28Chest'), t('common.14Chest'), t('common.staking')], runway: [ t('dashboard.tooltipItems.current'), `100K ${t('common.apy')}`, `50K ${t('common.apy')}`, `10K ${...
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
() => ({ tvl: t('dashboard.tooltipInfoMessages.tvl'), mvt: t('dashboard.tooltipInfoMessages.mvt'), pol: t('dashboard.tooltipInfoMessages.pol'), holder: t('dashboard.tooltipInfoMessages.holder'), staked: t('dashboard.tooltipInfoMessages.staked'), apy: t('dashboard.tooltipInfoMessages...
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
state => state.app.circSupply
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
state => state.app.totalSupply
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
state => state.app.marketPrice
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
state => state.app.pearlPrice
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
state => state.app.currentIndex
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
() => { setValueInCLAM(!valueInUSD); }
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
() => { apollo(treasuryDataQuery).then(r => { const metrics = r?.data.protocolMetrics .map((entry: any) => //Manually filter out any asset values below $10 // @ts-ignore Object.entries(entry).reduce((obj: any, [key, value]: [string, string]) => { if (key == '...
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
r => { const metrics = r?.data.protocolMetrics .map((entry: any) => //Manually filter out any asset values below $10 // @ts-ignore Object.entries(entry).reduce((obj: any, [key, value]: [string, string]) => { if (key == 'nextEpochRebase' || key == 'clamPrice') ret...
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
(entry: any) => //Manually filter out any asset values below $10 // @ts-ignore Object.entries(entry).reduce((obj: any, [key, value]: [string, string]) => { if (key == 'nextEpochRebase' || key == 'clamPrice') return (obj[key] = parseFloat(value)), obj; return (obj[k...
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
(obj: any, [key, value]: [string, string]) => { if (key == 'nextEpochRebase' || key == 'clamPrice') return (obj[key] = parseFloat(value)), obj; return (obj[key] = parseFloat(value) > 10 ? parseFloat(value) : 0), obj; }
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
(pm: any) => pm.treasuryMarketValue > 0
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
(entry: any) => ({ staked: (parseFloat(entry.sClamCirculatingSupply) / parseFloat(entry.clamCirculatingSupply)) * 100, timestamp: entry.timestamp, })
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
(pm: any) => pm.staked < 100
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
() => { apollo(treasuryRevenueQuery).then(r => { const revenues = r?.data.treasuryRevenues.map((entry: any) => // @ts-ignore Object.entries(entry).reduce((obj, [key, value]) => ((obj[key] = parseFloat(value)), obj), {}), ); // .filter((pm: any) => pm.treasuryMarketValue > 0); ...
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
r => { const revenues = r?.data.treasuryRevenues.map((entry: any) => // @ts-ignore Object.entries(entry).reduce((obj, [key, value]) => ((obj[key] = parseFloat(value)), obj), {}), ); // .filter((pm: any) => pm.treasuryMarketValue > 0); setRevenue(revenues); }
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
(entry: any) => // @ts-ignore Object.entries(entry).reduce((obj, [key, value]) => ((obj[key] = parseFloat(value)), obj), {})
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
(obj, [key, value]) => ((obj[key] = parseFloat(value)), obj)
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
({ title, value, info, image }, i) => ( <Box key={i}
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
p => p.dataKey
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
p => p.label
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
ArrowFunction
({ title, value, info }, i) => ( <Box key={i}
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
MethodDeclaration
t('dashboard.marketValue')
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
MethodDeclaration
t('common.treasuryRevenue')
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
MethodDeclaration
t('dashboard.tooltipInfoMessages.treasuryRevenue')
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
MethodDeclaration
formatCurrency(data?.[0
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
MethodDeclaration
t('dashboard.tooltipInfoMessages.marketCap') : t
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
MethodDeclaration
t('dashboard.buybacks')
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
MethodDeclaration
t('dashboard.tooltipInfoMessages.buybacks')
OtterClam/otter-frontend
src/views/Dashboard/TreasuryDashboard.tsx
TypeScript
FunctionDeclaration
export default function toIterator(iterable: unknown): Option<IteratorDelegate> { if (iterable instanceof EachInWrapper) { return toEachInIterator(iterable.inner); } else { return toEachIterator(iterable); } }
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
FunctionDeclaration
function toEachInIterator(iterable: unknown) { if (!isIndexable(iterable)) { return null; } if (Array.isArray(iterable) || isEmberArray(iterable)) { return ObjectIterator.fromIndexable(iterable); } else if (isNativeIterable<[unknown, unknown]>(iterable)) { return MapLikeNativeIterator.from(iterabl...
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
FunctionDeclaration
function toEachIterator(iterable: unknown) { if (!isObject(iterable)) { return null; } if (Array.isArray(iterable)) { return ArrayIterator.from(iterable); } else if (isEmberArray(iterable)) { return EmberArrayIterator.from(iterable); } else if (isNativeIterable(iterable)) { return ArrayLikeN...
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
FunctionDeclaration
function hasForEach(value: object): value is ForEachable { return typeof value['forEach'] === 'function'; }
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
FunctionDeclaration
function isNativeIterable<T = unknown>(value: object): value is Iterable<T> { return typeof value[Symbol.iterator] === 'function'; }
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
FunctionDeclaration
function isIndexable(value: unknown): value is Indexable { return value !== null && (typeof value === 'object' || typeof value === 'function'); }
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
ArrowFunction
(item) => array.push(item)
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
ClassDeclaration
abstract class BoundedIterator implements IteratorDelegate { private position = 0; constructor(private length: number) {} isEmpty(): false { return false; } abstract valueFor(position: number): unknown; memoFor(position: number): unknown { return position; } next() { let { length, posi...
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
ClassDeclaration
class ArrayIterator extends BoundedIterator { static from(iterable: unknown[]) { return iterable.length > 0 ? new this(iterable) : null; } static fromForEachable(object: ForEachable) { let array: unknown[] = []; object.forEach((item) => array.push(item)); return this.from(array); } construc...
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
ClassDeclaration
class EmberArrayIterator extends BoundedIterator { static from(iterable: EmberArray<unknown>) { return iterable.length > 0 ? new this(iterable) : null; } constructor(private array: EmberArray<unknown>) { super(array.length); } valueFor(position: number): unknown { return objectAt(this.array as ...
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
ClassDeclaration
class ObjectIterator extends BoundedIterator { static fromIndexable(obj: Indexable) { let keys = Object.keys(obj); if (keys.length === 0) { return null; } else { let values: unknown[] = []; for (let key of keys) { let value: any; value = obj[key]; // Add the t...
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
ClassDeclaration
abstract class NativeIterator<T = unknown> implements IteratorDelegate { static from<T>(this: NativeIteratorConstructor<T>, iterable: Iterable<T>) { let iterator = iterable[Symbol.iterator](); let result = iterator.next(); let { done } = result; if (done) { return null; } else { retu...
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
ClassDeclaration
class ArrayLikeNativeIterator extends NativeIterator { valueFor(result: IteratorResult<unknown>): unknown { return result.value; } memoFor(_result: IteratorResult<unknown>, position: number): unknown { return position; } }
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
ClassDeclaration
class MapLikeNativeIterator extends NativeIterator<[unknown, unknown]> { valueFor(result: IteratorResult<[unknown, unknown]>): unknown { return result.value[1]; } memoFor(result: IteratorResult<[unknown, unknown]>): unknown { return result.value[0]; } }
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
InterfaceDeclaration
interface NativeIteratorConstructor<T = unknown> { new (iterable: Iterator<T>, result: IteratorResult<T>): NativeIterator<T>; }
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
InterfaceDeclaration
interface ForEachable { forEach(callback: (item: unknown, key: unknown) => void): void; }
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
InterfaceDeclaration
interface Indexable { readonly [key: string]: unknown; }
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
MethodDeclaration
isEmpty(): false { return false; }
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript
MethodDeclaration
abstract valueFor(position: number): unknown;
EWhite613/ember.js
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
TypeScript