type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction |
() => {
setOpen(message ? true : false);
} | hyperledger/firefly-ui | src/components/Snackbar/MessageSnackbar.tsx | TypeScript |
ArrowFunction |
(theme) => ({
error: {
backgroundColor: theme.palette.error.main,
color: theme.palette.text.primary,
},
success: {
backgroundColor: theme.palette.success.main,
color: theme.palette.text.primary,
},
message: {
display: 'flex',
alignItems: 'center',
},
icon: {
marginRight: theme... | hyperledger/firefly-ui | src/components/Snackbar/MessageSnackbar.tsx | TypeScript |
InterfaceDeclaration |
interface MessageSnackbarProps {
message: string;
setMessage: React.Dispatch<React.SetStateAction<string>>;
messageType?: SnackbarMessageType;
} | hyperledger/firefly-ui | src/components/Snackbar/MessageSnackbar.tsx | TypeScript |
TypeAliasDeclaration |
export type SnackbarMessageType = 'error' | 'success'; | hyperledger/firefly-ui | src/components/Snackbar/MessageSnackbar.tsx | TypeScript |
FunctionDeclaration | // 将数字转化为 最多8位的 字符串 如 0.00000001
export function toNonExponential(num: number) {
const m: any = num.toExponential().match(/\d(?:\.(\d*))?e([+-]\d+)/);
let fiexed = Math.max(0, (m[1] || '').length - m[2]);
if (fiexed && fiexed > 8) {
fiexed = 8;
}
return num.toFixed(fiexed);
} | NewEconoLab/NELSwap-pc-react | src/utils/function.ts | TypeScript |
FunctionDeclaration |
export function getQueryString(name: string): string | null {
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
const r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
} | NewEconoLab/NELSwap-pc-react | src/utils/function.ts | TypeScript |
TypeAliasDeclaration |
export type BreadcrumbProps = TdBreadcrumbProps; | 94dreamer/tdesign-vue-next | src/breadcrumb/index.ts | TypeScript |
TypeAliasDeclaration |
export type BreadcrumbItemProps = TdBreadcrumbItemProps; | 94dreamer/tdesign-vue-next | src/breadcrumb/index.ts | TypeScript |
ArrowFunction |
() => import('@/views/axios.vue') | fengdanbailu/vue3-demo | src/router/index.ts | TypeScript |
FunctionDeclaration |
function checkDeadline(deadline: string[] | string): void {
expect(typeof deadline).toBe('string')
invariant(typeof deadline === 'string')
// less than 5 seconds on the deadline
expect(new Date().getTime() / 1000 - parseInt(deadline)).toBeLessThanOrEqual(5)
} | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
it('ether to token1', () => {
const result = Router.swapCallParameters(
Trade.exactIn(
new Route([pair_weth_0, pair_0_1], CAVAX, token1),
CurrencyAmount.ether(JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{ ttl: 50, recipient: '0x0000000... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
const result = Router.swapCallParameters(
Trade.exactIn(
new Route([pair_weth_0, pair_0_1], CAVAX, token1),
CurrencyAmount.ether(JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{ ttl: 50, recipient: '0x0000000000000000000000000000000000000004', ... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
const result = Router.swapCallParameters(
Trade.exactIn(
new Route([pair_0_1, pair_weth_0], token1, CAVAX),
new TokenAmount(token1, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{ ttl: 50, recipient: '0x0000000000000000000000000000000000000004... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
const result = Router.swapCallParameters(
Trade.exactIn(
new Route([pair_0_1], token0, token1),
new TokenAmount(token0, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{ ttl: 50, recipient: '0x0000000000000000000000000000000000000004', allowedSl... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
it('ether to token1', () => {
const result = Router.swapCallParameters(
Trade.exactOut(
new Route([pair_weth_0, pair_0_1], CAVAX, token1),
new TokenAmount(token1, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{ ttl: 50, recipient: '0x000... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
const result = Router.swapCallParameters(
Trade.exactOut(
new Route([pair_weth_0, pair_0_1], CAVAX, token1),
new TokenAmount(token1, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{ ttl: 50, recipient: '0x000000000000000000000000000000000000000... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
const result = Router.swapCallParameters(
Trade.exactOut(
new Route([pair_0_1, pair_weth_0], token1, CAVAX),
CurrencyAmount.ether(JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{ ttl: 50, recipient: '0x0000000000000000000000000000000000000004',... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
const result = Router.swapCallParameters(
Trade.exactOut(
new Route([pair_0_1], token0, token1),
new TokenAmount(token1, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{ ttl: 50, recipient: '0x0000000000000000000000000000000000000004', allowedS... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
describe('exact in', () => {
it('ether to token1', () => {
const result = Router.swapCallParameters(
Trade.exactIn(
new Route([pair_weth_0, pair_0_1], CAVAX, token1),
CurrencyAmount.ether(JSBI.BigInt(100)),
ChainId.AVALANCHE
... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
it('ether to token1', () => {
const result = Router.swapCallParameters(
Trade.exactIn(
new Route([pair_weth_0, pair_0_1], CAVAX, token1),
CurrencyAmount.ether(JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{
... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
const result = Router.swapCallParameters(
Trade.exactIn(
new Route([pair_weth_0, pair_0_1], CAVAX, token1),
CurrencyAmount.ether(JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{
ttl: 50,
recipient: '0x0... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
const result = Router.swapCallParameters(
Trade.exactIn(
new Route([pair_0_1, pair_weth_0], token1, CAVAX),
new TokenAmount(token1, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{
ttl: 50,
recipient: '... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
const result = Router.swapCallParameters(
Trade.exactIn(
new Route([pair_0_1], token0, token1),
new TokenAmount(token0, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{
ttl: 50,
recipient: '0x0000000000... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
it('ether to token1', () => {
expect(() =>
Router.swapCallParameters(
Trade.exactOut(
new Route([pair_weth_0, pair_0_1], CAVAX, token1),
new TokenAmount(token1, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
expect(() =>
Router.swapCallParameters(
Trade.exactOut(
new Route([pair_weth_0, pair_0_1], CAVAX, token1),
new TokenAmount(token1, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{
ttl: 50,
... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() =>
Router.swapCallParameters(
Trade.exactOut(
new Route([pair_weth_0, pair_0_1], CAVAX, token1),
new TokenAmount(token1, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{
ttl: 50,
recipient:... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
expect(() =>
Router.swapCallParameters(
Trade.exactOut(
new Route([pair_0_1, pair_weth_0], token1, CAVAX),
CurrencyAmount.ether(JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{
ttl: 50,
... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() =>
Router.swapCallParameters(
Trade.exactOut(
new Route([pair_0_1, pair_weth_0], token1, CAVAX),
CurrencyAmount.ether(JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{
ttl: 50,
recipient: '0... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
expect(() =>
Router.swapCallParameters(
Trade.exactOut(
new Route([pair_0_1], token0, token1),
new TokenAmount(token1, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{
ttl: 50,
... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() =>
Router.swapCallParameters(
Trade.exactOut(
new Route([pair_0_1], token0, token1),
new TokenAmount(token1, JSBI.BigInt(100)),
ChainId.AVALANCHE
),
{
ttl: 50,
recipient: '0x00000000... | PartySwapDEX/party-swap-sdk | test/router.test.ts | TypeScript |
ArrowFunction |
() => {
const { coreProxy } = useStoreContext();
const { closeModal } = useLayoutContext();
const [inputValue, setInputValue] = useState<string>("");
const [privateKeyType, setPrivateKeyType] = useState<string>("");
const [errorMessage, setErrorMessage] = useState<string>("");
const handleSubmit = () => {... | GoHypernet/hypernet-protocol | packages/web-ui/src/flows/PrivateKeysFlow/PrivateKeysFlow.tsx | TypeScript |
ArrowFunction |
() => {
const privateKey = privateKeyType === "privateKey" ? inputValue : null;
const mnemonic = privateKeyType === "mnemonic" ? inputValue : null;
coreProxy.providePrivateCredentials(privateKey, mnemonic).match(
() => {
closeModal();
},
(err) => {
setErrorMessage(err.mess... | GoHypernet/hypernet-protocol | packages/web-ui/src/flows/PrivateKeysFlow/PrivateKeysFlow.tsx | TypeScript |
ArrowFunction |
() => {
closeModal();
} | GoHypernet/hypernet-protocol | packages/web-ui/src/flows/PrivateKeysFlow/PrivateKeysFlow.tsx | TypeScript |
ArrowFunction |
(err) => {
setErrorMessage(err.message || "Err while providePrivateCredentials.");
} | GoHypernet/hypernet-protocol | packages/web-ui/src/flows/PrivateKeysFlow/PrivateKeysFlow.tsx | TypeScript |
ArrowFunction |
() => {
it('3 layers', () => {
expect(hanoiTowerSteps(3)).toBe(7)
})
} | tony-cn/js-algorithms | test/HanoiTower.test.ts | TypeScript |
ArrowFunction |
() => {
expect(hanoiTowerSteps(3)).toBe(7)
} | tony-cn/js-algorithms | test/HanoiTower.test.ts | TypeScript |
FunctionDeclaration |
export function migrate(storage: DBStorage): { migrated: boolean } {
const version = getDBVersion(storage)
// Update version upon each successful migration, so we don't
// need to migrate that part again if later parts fail.
if (version < 3) { migrateV2ToV3(storage); setDBVersion(storage, 3) }
if (version <... | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | /// v4.0.0 - v4.23.2
function migrateV2ToV3(storage: DBStorage) {
const state = storage.get("CharacterDisplay.state")
if (state) {
if (Array.isArray(state.elementalFilter)) state.elementalFilter = ""
if (Array.isArray(state.weaponFilter)) state.weaponFilter = ""
storage.set("CharacterDisplay.state", sta... | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | /// v5.0.0 - v5.7.15
function migrateV3ToV4(storage: DBStorage) { //
// Convert anemo traveler to traveler, and remove geo traveler
const traveler = storage.get("char_traveler_anemo")
// Deletion of old travelers are handled during validation
if (traveler) {
traveler.elementKey = "anemo"
traveler.char... | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | /// v5.8.0 - v5.11.5
function migrateV4ToV5(storage: DBStorage) {
for (const key of storage.keys) {
if (key.startsWith("char_")) {
const value = storage.get(key)
const levelKey = value.levelKey ?? "L1"
const [, lvla] = levelKey.split("L")
const level = parseInt(lvla)
const ascension... | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | // v5.12.0 - 5.19.14
function migrateV5ToV6(storage: DBStorage) {
for (const key of storage.keys) {
if (key.startsWith("char_")) {
const character = storage.get(key)
// Migrate character weapon levels
if (!character.weapon) continue
const levelKey = character.weapon.levelKey ?? "L1"
... | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | // 5.20.0 - 6.0.0
function migrateV6ToV7(storage: DBStorage) {
for (const key of storage.keys) {
if (key.startsWith("char_")) {
const character = storage.get(key)
if (!character.buildSettings) character.buildSettings = initialBuildSettings()
else {
const [sands, goblet, circlet] = (Array... | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | // 6.0.0 - 6.0.17
function migrateV7ToV8(storage: DBStorage) {
const weaponKeyChangeMap = {
"PrototypeAminus": "PrototypeArchaic",
"PrototypeGrudge": "PrototypeStarglitter",
"PrototypeMalice": "PrototypeAmber"
} as const
let keyInd = 1;
function generateWeaponId(storage: DBStorage) {
let key = `... | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration |
function generateWeaponId(storage: DBStorage) {
let key = `weapon_${keyInd++}`
while (storage.keys.includes(key))
key = `weapon_${keyInd++}`
return key
} | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | // 6.1.0 - 6.1.5
function migrateV8ToV9(storage: DBStorage) {
for (const key of storage.keys) {
if (key.startsWith("char_")) {
const character = storage.get(key)
const { buildSettings = {} } = character
delete buildSettings.ascending
const { statFilters = {} } = buildSettings
for (co... | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | // 6.1.6 - 6.1.8
function migrateV9ToV10(storage: DBStorage) {
for (const key of storage.keys) {
if (key.startsWith("weapon_")) {
const weapon = storage.get(key)
if (weapon.refine) {
weapon.refinement = weapon.refine
storage.set(key, weapon)
}
}
}
} | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | // 6.1.9 - 6.2.3
function migrateV10ToV11(storage: DBStorage) {
for (const key of storage.keys) {
if (key.startsWith("char_")) {
const character = storage.get(key)
const { baseStatOverrides = {} } = character
if (baseStatOverrides.critRate_) baseStatOverrides.critRate_ -= 5
if (baseStatOve... | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | // 7.0.0 - 7.2.11
function migrateV11ToV12(storage: DBStorage) {
//UI was changed quite a lot, deleting state should be easiest for migration.
storage.remove("CharacterDisplay.state")
storage.remove("WeaponDisplay.state")
for (const key of storage.keys) {
if (key.startsWith("weapon_")) {
const weapon... | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration | // 7.3.0 - present
function migrateV12ToV13(storage: DBStorage) {
//UI was changed quite a lot, deleting state should be easiest for migration.
storage.remove("ArtifactDisplay.state")
} | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
ArrowFunction |
maxLevel => level <= maxLevel | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
ArrowFunction |
k => [k.toLowerCase(), k] | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
ArrowFunction |
([key, value]: [any, any]) => [key, value + 1] | Jomata/genshin-optimizer | src/Database/migration.ts | TypeScript |
FunctionDeclaration |
export function htmlEscapeJsonString(str: string): string {
return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
} | lnlfps/symphony-joy | packages/joy/src/server/htmlescape.ts | TypeScript |
ArrowFunction |
(match) => ESCAPE_LOOKUP[match] | lnlfps/symphony-joy | packages/joy/src/server/htmlescape.ts | TypeScript |
InterfaceDeclaration |
export interface FirstStepClass {
firstName: string;
lastName: string;
age: number;
} | DenMic/ng-toolbar-wizard | projects/test-lib/src/app/Class/first-step-class.ts | TypeScript |
ArrowFunction |
({ maxWidth }) => maxWidth && `max-width: ${maxWidth}px;` | spaces-ga/amsterdam-styled-components | packages/asc-ui/src/components/Card/CardStyle.ts | TypeScript |
ArrowFunction |
({ shadow, theme }) =>
shadow && `box-shadow: 2px 2px ${themeColor('tint', 'level3')({ theme })};` | spaces-ga/amsterdam-styled-components | packages/asc-ui/src/components/Card/CardStyle.ts | TypeScript |
ArrowFunction |
({ backgroundColor, theme }) =>
themeColor('tint', backgroundColor || 'level1')({ theme }) | spaces-ga/amsterdam-styled-components | packages/asc-ui/src/components/Card/CardStyle.ts | TypeScript |
ArrowFunction |
({ horizontal }) => (horizontal ? 'row' : 'column') | spaces-ga/amsterdam-styled-components | packages/asc-ui/src/components/Card/CardStyle.ts | TypeScript |
ArrowFunction |
({ horizontal }) =>
horizontal &&
css`
${CardActionsStyle} {
width: initial;
padding: 24px 16px;
}
` | spaces-ga/amsterdam-styled-components | packages/asc-ui/src/components/Card/CardStyle.ts | TypeScript |
ArrowFunction |
({ isLoading, animateLoading, theme }) =>
isLoading &&
css`
${perceivedLoading(theme, animateLoading)}
${CardMediaWrapperStyle} {
${perceivedLoading(theme, animateLoading)}
}
${CardContentStyle} > * {
display: none;
}
` | spaces-ga/amsterdam-styled-components | packages/asc-ui/src/components/Card/CardStyle.ts | TypeScript |
TypeAliasDeclaration |
export type Props = {
maxWidth?: number
shadow?: boolean
horizontal?: boolean
backgroundColor?: keyof Theme.Tint
isLoading?: boolean
animateLoading?: boolean
} | spaces-ga/amsterdam-styled-components | packages/asc-ui/src/components/Card/CardStyle.ts | TypeScript |
ArrowFunction |
h => h(App) | hxj2221/hxj2221-Security-Information1 | src/main.ts | TypeScript |
FunctionDeclaration | /**
* Simple Promiseify function that takes a Node API and return a version that supports promises.
* We use promises instead of synchronized functions to make the process less I/O bound and
* faster. It also simplifies the code.
*/
function promiseify(fn): (...args) => Promise<any> {
return function () {
con... | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
FunctionDeclaration |
export function inlineResources(projectPath: string): Promise<any> {
// Match only TypeScript files in projectPath
const files = glob.sync('**/*.ts', { cwd: projectPath })
// For each file, inline the templates and styles under it and write the new file.
return Promise.all(files.map(filePath => {
const fu... | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
FunctionDeclaration | // Inline the resources from a string content
function inlineResourcesFromString(content: string, urlResolver: (url: string) => string): string {
// Curry through the inlining functions
return [
inlineTemplate,
inlineStyle,
removeModuleId
].reduce((cnt, fn) => fn(cnt, urlResolver), content)
} | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
FunctionDeclaration | // Inline the templates for a sourcefile. Simply serach for instances of `templateUrl: ...` and
// replace with `template: ...` (with the content of the file included).
function inlineTemplate(content: string, urlResolver: (url: string) => string): string {
return content.replace(/templateUrl:\s*'([^']+?\.html)'/g, (... | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
FunctionDeclaration | // Inline the styles for a source file. Simply search for instances of `styleurls: [...]` and
// replace with `styles: [...]` (with the content of the file included).
function inlineStyle(content: string, urlResolver: (url: string) => string): string {
return content.replace(/styleUrls:\s*(\[[\s\S]*?\])/gm, (m, style... | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
FunctionDeclaration | // Remove any mention of `moduleId: module.id`
function removeModuleId(content): string {
return content.replace(/\s*moduleId:\s*module\.id\s*,?\s*/gm, '')
} | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
fn.apply(this, args.concat([function (err, value) {
if (err) {
reject(err)
} else {
resolve(value)
}
}]))
} | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
filePath => {
const fullFilePath = path.join(projectPath, filePath)
return readFilePr(fullFilePath, 'utf-8')
.then(content => inlineResourcesFromString(content, url => {
// Resolve the template url.
return path.join(path.dirname(fullFilePath), url)
}))
.then(content => writeFi... | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
content => inlineResourcesFromString(content, url => {
// Resolve the template url.
return path.join(path.dirname(fullFilePath), url)
}) | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
url => {
// Resolve the template url.
return path.join(path.dirname(fullFilePath), url)
} | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
content => writeFilePr(fullFilePath, content) | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
err => {
console.error('An error occured: ', err)
} | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
(cnt, fn) => fn(cnt, urlResolver) | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
(m, templateUrl) => {
const templateFile = urlResolver(templateUrl)
const templateContent = readFileSync(templateFile, 'utf-8')
const shortenedTemplate = templateContent
.replace(/([\n\r]\s*)+/gm, ' ')
.replace(/"/g, '\\"')
return `template: "${shortenedTemplate}"`
} | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
(m, styleUrls) => {
const urls = eval(styleUrls)
return 'styles: ['
+ urls.map(styleUrl => {
const styleFile = urlResolver(styleUrl)
const styleContent = readFileSync(styleFile, 'utf-8')
const shortenedStyle = styleContent
.replace(/([\n\r]\s*)+/gm, '')
.replac... | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
styleUrl => {
const styleFile = urlResolver(styleUrl)
const styleContent = readFileSync(styleFile, 'utf-8')
const shortenedStyle = styleContent
.replace(/([\n\r]\s*)+/gm, '')
.replace(/"/g, '\\"')
return `"${shortenedStyle}"`
} | jgainfort/ng-library-compiler | src/inline-resources.ts | TypeScript |
ArrowFunction |
()=>{
return (
<>
<TopBanner />
<PolicyQuestionsCards />
<TopicsExplorer />
</>
);
} | vannizhang/policymaps-new | src/components/OverviewPageContents/OverviewPageContents.tsx | TypeScript |
FunctionDeclaration |
function type(text: string) {
wrapper.find('[data-test-id="compose"]').setValue(text)
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
let wrapper: Wrapper<InstanceType<typeof Compose>>
beforeEach(() => {
wrapper = mount(
Compose,
baseMountOpts({
mocks: {
$store: authedUserCreateStore(),
$accessor: authedAccessor(),
},
attachTo: document.createElement('div'),
})
)
})
... | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
wrapper = mount(
Compose,
baseMountOpts({
mocks: {
$store: authedUserCreateStore(),
$accessor: authedAccessor(),
},
attachTo: document.createElement('div'),
})
)
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
test('default postCounter is 256', () => {
const remaining = +wrapper.find('[data-test-id="post-counter"]').text()
expect(remaining).toBe(256)
})
describe('when text length is 128', () => {
test('postCounter equals 128', async () => {
type('a'.repeat(128))
await ne... | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
const remaining = +wrapper.find('[data-test-id="post-counter"]').text()
expect(remaining).toBe(256)
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
test('postCounter equals 128', async () => {
type('a'.repeat(128))
await new Promise((resolve) => setTimeout(resolve, 500))
const remaining = +wrapper.find('[data-test-id="post-counter"]').text()
expect(remaining).toBe(128)
})
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
async () => {
type('a'.repeat(128))
await new Promise((resolve) => setTimeout(resolve, 500))
const remaining = +wrapper.find('[data-test-id="post-counter"]').text()
expect(remaining).toBe(128)
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
(resolve) => setTimeout(resolve, 500) | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
test('postCounter equals 0', async () => {
type('a'.repeat(256))
await new Promise((resolve) => setTimeout(resolve, 500))
const remaining = +wrapper.find('[data-test-id="post-counter"]').text()
expect(remaining).toBe(0)
})
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
async () => {
type('a'.repeat(256))
await new Promise((resolve) => setTimeout(resolve, 500))
const remaining = +wrapper.find('[data-test-id="post-counter"]').text()
expect(remaining).toBe(0)
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
test('postCounter equals -10', async () => {
type('a'.repeat(266))
await new Promise((resolve) => setTimeout(resolve, 500))
const remaining = +wrapper.find('[data-test-id="post-counter"]').text()
expect(remaining).toBe(-10)
})
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
async () => {
type('a'.repeat(266))
await new Promise((resolve) => setTimeout(resolve, 500))
const remaining = +wrapper.find('[data-test-id="post-counter"]').text()
expect(remaining).toBe(-10)
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
// FIXME
// disabled textarea and submit button when posted
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
let $submitButton: Wrapper<Vue>
beforeEach(() => {
$submitButton = wrapper.find('button[type="submit"]')
})
test('disabled if text is empty', () => {
expect($submitButton.attributes().disabled).toBe('disabled')
})
test('disabled if message is over 256 characters', () => {
... | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
$submitButton = wrapper.find('button[type="submit"]')
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
expect($submitButton.attributes().disabled).toBe('disabled')
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
type('a'.repeat(260))
expect($submitButton.attributes().disabled).toBe('disabled')
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
test('is visible', () => {
expect(wrapper.find('.open-emoji-picker').element).toBeVisible()
})
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(wrapper.find('.open-emoji-picker').element).toBeVisible()
} | 33mhz/beta | __tests__/components/Compose.spec.ts | TypeScript |
ArrowFunction |
async (): Promise<boolean> => {
try {
const { refreshToken, refreshTokenExpiryDate } = await asyncStorage.getRefreshToken();
if (refreshToken && asyncStorage.isTokenValid(refreshToken, refreshTokenExpiryDate)) {
const token = await Authentication.refreshToken({ refreshToken });
await asyncStorag... | sophiemoustard/alenvi-mobile | src/core/helpers/alenvi.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.