type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
(result: any) => {
state.about = result.data;
} | 7xi/apicloud-vue-cli4 | src/store/mutations.ts | TypeScript |
MethodDeclaration |
[types.SET_APPCONFIG_MUTATION](state: any, payload: any) {
state.appConfig = payload;
} | 7xi/apicloud-vue-cli4 | src/store/mutations.ts | TypeScript |
MethodDeclaration |
[types.SET_ABOUT_MUTATION](state: any, payload: any) {
reqAbout({}).then((result: any) => {
state.about = result.data;
});
} | 7xi/apicloud-vue-cli4 | src/store/mutations.ts | TypeScript |
ArrowFunction |
() => {
const config = AppConfig.instance;
it('can provide a bearer token', async () => {
const token = await config.getBearerToken();
expect(token).toBeDefined();
});
} | macsj200/aws-serverless-tweet-event-source | src/AppConfig.integ.ts | TypeScript |
ArrowFunction |
async () => {
const token = await config.getBearerToken();
expect(token).toBeDefined();
} | macsj200/aws-serverless-tweet-event-source | src/AppConfig.integ.ts | TypeScript |
ArrowFunction |
({
transaction,
activeAccountName,
}: PropsFromRedux & DelegationTransactionProps) => {
const getDetail = () => {
if (activeAccountName === transaction.delegator) {
if (parseFloat(transaction.amount.split(' ')[0]) === 0) {
return chrome.i18n.getMessage(
'popup_html_wallet_info_cancel_delegation_out',
[transaction.delegatee],
);
} else {
return chrome.i18n.getMessage('popup_html_wallet_info_delegation_out', [
FormatUtils.withCommas(transaction.amount, 3),
transaction.delegatee,
]);
}
} else {
if (parseFloat(transaction.amount.split(' ')[0]) === 0) {
return chrome.i18n.getMessage(
'popup_html_wallet_info_cancel_delegation_in',
[transaction.delegator],
);
} else {
return chrome.i18n.getMessage('popup_html_wallet_info_delegation_in', [
transaction.delegator,
transaction.amount,
]);
}
}
};
return (
<GenericTransactionComponent
transaction={transaction}
detail={getDetail()}></GenericTransactionComponent> | hive-keychain/hive-keychain | src/popup/pages/app-container/home/wallet-history/wallet-history-item/wallet-transaction-info/wallet-transaction-types/delegation-transaction/delegation-transaction.component.tsx | TypeScript |
ArrowFunction |
() => {
if (activeAccountName === transaction.delegator) {
if (parseFloat(transaction.amount.split(' ')[0]) === 0) {
return chrome.i18n.getMessage(
'popup_html_wallet_info_cancel_delegation_out',
[transaction.delegatee],
);
} else {
return chrome.i18n.getMessage('popup_html_wallet_info_delegation_out', [
FormatUtils.withCommas(transaction.amount, 3),
transaction.delegatee,
]);
}
} else {
if (parseFloat(transaction.amount.split(' ')[0]) === 0) {
return chrome.i18n.getMessage(
'popup_html_wallet_info_cancel_delegation_in',
[transaction.delegator],
);
} else {
return chrome.i18n.getMessage('popup_html_wallet_info_delegation_in', [
transaction.delegator,
transaction.amount,
]);
}
}
} | hive-keychain/hive-keychain | src/popup/pages/app-container/home/wallet-history/wallet-history-item/wallet-transaction-info/wallet-transaction-types/delegation-transaction/delegation-transaction.component.tsx | TypeScript |
ArrowFunction |
(state: RootState) => {
return { activeAccountName: state.activeAccount.name };
} | hive-keychain/hive-keychain | src/popup/pages/app-container/home/wallet-history/wallet-history-item/wallet-transaction-info/wallet-transaction-types/delegation-transaction/delegation-transaction.component.tsx | TypeScript |
InterfaceDeclaration |
interface DelegationTransactionProps {
transaction: Delegation;
} | hive-keychain/hive-keychain | src/popup/pages/app-container/home/wallet-history/wallet-history-item/wallet-transaction-info/wallet-transaction-types/delegation-transaction/delegation-transaction.component.tsx | TypeScript |
MethodDeclaration |
getDetail() | hive-keychain/hive-keychain | src/popup/pages/app-container/home/wallet-history/wallet-history-item/wallet-transaction-info/wallet-transaction-types/delegation-transaction/delegation-transaction.component.tsx | TypeScript |
ClassDeclaration |
export class DeleteLoggingConfigurationCommand extends $Command<
DeleteLoggingConfigurationCommandInput,
DeleteLoggingConfigurationCommandOutput,
WAFV2ClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties
constructor(readonly input: DeleteLoggingConfigurationCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: WAFV2ClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<DeleteLoggingConfigurationCommandInput, DeleteLoggingConfigurationCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const clientName = "WAFV2Client";
const commandName = "DeleteLoggingConfigurationCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: DeleteLoggingConfigurationRequest.filterSensitiveLog,
outputFilterSensitiveLog: DeleteLoggingConfigurationResponse.filterSensitiveLog,
};
if (typeof logger.info === "function") {
logger.info({
clientName,
commandName,
});
}
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}
private serialize(input: DeleteLoggingConfigurationCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_json1_1DeleteLoggingConfigurationCommand(input, context);
}
private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<DeleteLoggingConfigurationCommandOutput> {
return deserializeAws_json1_1DeleteLoggingConfigurationCommand(output, context);
}
// Start section: command_body_extra
// End section: command_body_extra
} | EricCrosson/aws-sdk-js-v3 | clients/client-wafv2/commands/DeleteLoggingConfigurationCommand.ts | TypeScript |
TypeAliasDeclaration |
export type DeleteLoggingConfigurationCommandInput = DeleteLoggingConfigurationRequest; | EricCrosson/aws-sdk-js-v3 | clients/client-wafv2/commands/DeleteLoggingConfigurationCommand.ts | TypeScript |
TypeAliasDeclaration |
export type DeleteLoggingConfigurationCommandOutput = DeleteLoggingConfigurationResponse & __MetadataBearer; | EricCrosson/aws-sdk-js-v3 | clients/client-wafv2/commands/DeleteLoggingConfigurationCommand.ts | TypeScript |
MethodDeclaration |
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: WAFV2ClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<DeleteLoggingConfigurationCommandInput, DeleteLoggingConfigurationCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const clientName = "WAFV2Client";
const commandName = "DeleteLoggingConfigurationCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: DeleteLoggingConfigurationRequest.filterSensitiveLog,
outputFilterSensitiveLog: DeleteLoggingConfigurationResponse.filterSensitiveLog,
};
if (typeof logger.info === "function") {
logger.info({
clientName,
commandName,
});
}
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
} | EricCrosson/aws-sdk-js-v3 | clients/client-wafv2/commands/DeleteLoggingConfigurationCommand.ts | TypeScript |
MethodDeclaration |
private serialize(input: DeleteLoggingConfigurationCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_json1_1DeleteLoggingConfigurationCommand(input, context);
} | EricCrosson/aws-sdk-js-v3 | clients/client-wafv2/commands/DeleteLoggingConfigurationCommand.ts | TypeScript |
MethodDeclaration |
private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<DeleteLoggingConfigurationCommandOutput> {
return deserializeAws_json1_1DeleteLoggingConfigurationCommand(output, context);
} | EricCrosson/aws-sdk-js-v3 | clients/client-wafv2/commands/DeleteLoggingConfigurationCommand.ts | TypeScript |
ArrowFunction |
() => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchemaOnConnection: true,
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
it("entityManager should allow you to save unrelated entities with one persist call", () => Promise.all(connections.map(async connection => {
const car = new Car();
car.name = "Ferrari";
const fruit = new Fruit();
fruit.name = "Banana";
const [savedCar, savedFruit] = await connection.manager.save([car, fruit]);
expect(savedFruit).to.have.property("name", "Banana");
expect(savedFruit).to.be.instanceof(Fruit);
expect(savedCar).to.have.property("name", "Ferrari");
expect(savedCar).to.be.instanceof(Car);
const cars = await connection.manager.find(Car);
// before the changes in this PR, all the tests before this one actually passed
expect(cars).to.length(1);
expect(cars[0]).to.have.property("name", "Ferrari");
const fruits = await connection.manager.find(Fruit);
expect(fruits).to.length(1);
expect(fruits[0]).to.have.property("name", "Banana");
})));
it("entityManager should allow you to delete unrelated entities with one remove call", () => Promise.all(connections.map(async connection => {
const fruit = new Fruit();
fruit.name = "Banana";
const fruit2 = new Fruit();
fruit2.name = "Apple";
const [savedFruit] = await connection.manager.save([fruit, fruit2]);
const car = new Car();
car.name = "Ferrari";
const savedCar = await connection.manager.save(car);
await connection.manager.remove([savedCar, savedFruit]);
const cars = await connection.manager.find(Car);
expect(cars).to.length(0);
const fruits = await connection.manager.find(Fruit);
expect(fruits).to.length(1);
expect(fruits[0]).to.have.property("name", "Apple");
})));
} | hisamu/typeorm | test/github-issues/363/issue-363.ts | TypeScript |
ArrowFunction |
(
entries: string[],
operation: "copy" | "move"
): void =>
setPasteList(
Object.fromEntries(entries.map((entry) => [entry, operation]))
) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(entry) => [entry, operation] | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(entries: string[]): void =>
updatePasteEntries(entries, "copy") | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(entries: string[]): void =>
updatePasteEntries(entries, "move") | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(folder: string, updateFiles: UpdateFiles): void =>
setFsWatchers((currentFsWatcher) => ({
...currentFsWatcher,
[folder]: [...(currentFsWatcher[folder] || []), updateFiles],
})) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(currentFsWatcher) => ({
...currentFsWatcher,
[folder]: [...(currentFsWatcher[folder] || []), updateFiles],
}) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(folder: string, updateFiles: UpdateFiles): void =>
setFsWatchers((currentFsWatcher) => ({
...currentFsWatcher,
[folder]: (currentFsWatcher[folder] || []).filter(
(updateFilesInstance) => updateFilesInstance !== updateFiles
),
})) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(currentFsWatcher) => ({
...currentFsWatcher,
[folder]: (currentFsWatcher[folder] || []).filter(
(updateFilesInstance) => updateFilesInstance !== updateFiles
),
}) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(updateFilesInstance) => updateFilesInstance !== updateFiles | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(folder: string, newFile?: string, oldFile?: string): void => {
const relevantPaths =
folder === "/"
? [folder]
: Object.keys(fsWatchers).filter((fsPath) => fsPath === folder);
const parentPath = !fsWatchers[folder] ? [dirname(folder)] : [];
[...parentPath, ...relevantPaths].forEach((watchedFolder) =>
fsWatchers[watchedFolder]?.forEach((updateFiles) =>
watchedFolder === folder
? updateFiles(newFile, oldFile)
: updateFiles()
)
);
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(fsPath) => fsPath === folder | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(watchedFolder) =>
fsWatchers[watchedFolder]?.forEach((updateFiles) =>
watchedFolder === folder
? updateFiles(newFile, oldFile)
: updateFiles()
) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(updateFiles) =>
watchedFolder === folder
? updateFiles(newFile, oldFile)
: updateFiles() | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
async (
directory: string,
existingHandle?: FileSystemDirectoryHandle
): Promise<string> => {
let handle: FileSystemDirectoryHandle;
try {
handle = existingHandle ?? (await window.showDirectoryPicker());
} catch {
// Ignore cancelling the dialog
}
return new Promise((resolve, reject) => {
if (handle instanceof FileSystemDirectoryHandle) {
FileSystemAccess?.Create({ handle }, (error, newFs) => {
if (error || !newFs) reject();
else {
rootFs?.mount?.(join(directory, handle.name), newFs);
resolve(handle.name);
addFileSystemHandle(directory, handle);
}
});
}
});
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
if (handle instanceof FileSystemDirectoryHandle) {
FileSystemAccess?.Create({ handle }, (error, newFs) => {
if (error || !newFs) reject();
else {
rootFs?.mount?.(join(directory, handle.name), newFs);
resolve(handle.name);
addFileSystemHandle(directory, handle);
}
});
}
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(error, newFs) => {
if (error || !newFs) reject();
else {
rootFs?.mount?.(join(directory, handle.name), newFs);
resolve(handle.name);
addFileSystemHandle(directory, handle);
}
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
async (url: string): Promise<void> => {
const fileData = await readFile(url);
return new Promise((resolve, reject) => {
const createFs: BFSCallback<IIsoFS | IZipFS> = (createError, newFs) => {
if (createError) reject();
else if (newFs) {
rootFs?.mount?.(url, newFs);
resolve();
}
};
if (extname(url).toLowerCase() === ".iso") {
IsoFS?.Create({ data: fileData }, createFs);
} else {
ZipFS?.Create({ zipData: fileData }, createFs);
}
});
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
const createFs: BFSCallback<IIsoFS | IZipFS> = (createError, newFs) => {
if (createError) reject();
else if (newFs) {
rootFs?.mount?.(url, newFs);
resolve();
}
};
if (extname(url).toLowerCase() === ".iso") {
IsoFS?.Create({ data: fileData }, createFs);
} else {
ZipFS?.Create({ zipData: fileData }, createFs);
}
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(createError, newFs) => {
if (createError) reject();
else if (newFs) {
rootFs?.mount?.(url, newFs);
resolve();
}
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(url: string): void => rootFs?.umount?.(url) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(directory: string): void => {
updateFolder(dirname(directory), undefined, directory);
removeFileSystemHandle(directory);
unMountFs(directory);
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(
directory: string,
callback: (name: string, buffer?: Buffer) => void
): void => {
const fileInput = document.createElement("input");
fileInput.type = "file";
fileInput.multiple = true;
fileInput.setAttribute("style", "display: none");
fileInput.addEventListener(
"change",
(event) =>
handleFileInputEvent(
event,
callback,
directory,
openTransferDialog
).then(() => fileInput.remove()),
{ once: true }
);
document.body.appendChild(fileInput);
fileInput.click();
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(event) =>
handleFileInputEvent(
event,
callback,
directory,
openTransferDialog
).then(() => fileInput.remove()) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
() => fileInput.remove() | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(): Promise<void> =>
new Promise((resolve, reject) => {
localStorage.clear();
sessionStorage.clear();
const clearFs = (): void => {
const overlayFs = rootFs?._getFs("/")?.fs as OverlayFS;
const overlayedFileSystems = overlayFs?.getOverlayedFileSystems();
const readable = overlayedFileSystems?.readable as HTTPRequest;
const writable = overlayedFileSystems?.writable as IndexedDBFileSystem;
readable?.empty();
if (writable?.getName() === "InMemory") {
resolve();
} else {
writable?.empty((apiError) =>
apiError ? reject(apiError) : resolve()
);
}
};
if (!window.indexedDB.databases) clearFs();
else {
window.indexedDB.databases().then((databases) => {
databases
.filter(({ name }) => name !== "browserfs")
.forEach(
({ name }) => name && window.indexedDB.deleteDatabase(name)
);
clearFs();
});
}
}) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
localStorage.clear();
sessionStorage.clear();
const clearFs = (): void => {
const overlayFs = rootFs?._getFs("/")?.fs as OverlayFS;
const overlayedFileSystems = overlayFs?.getOverlayedFileSystems();
const readable = overlayedFileSystems?.readable as HTTPRequest;
const writable = overlayedFileSystems?.writable as IndexedDBFileSystem;
readable?.empty();
if (writable?.getName() === "InMemory") {
resolve();
} else {
writable?.empty((apiError) =>
apiError ? reject(apiError) : resolve()
);
}
};
if (!window.indexedDB.databases) clearFs();
else {
window.indexedDB.databases().then((databases) => {
databases
.filter(({ name }) => name !== "browserfs")
.forEach(
({ name }) => name && window.indexedDB.deleteDatabase(name)
);
clearFs();
});
}
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(): void => {
const overlayFs = rootFs?._getFs("/")?.fs as OverlayFS;
const overlayedFileSystems = overlayFs?.getOverlayedFileSystems();
const readable = overlayedFileSystems?.readable as HTTPRequest;
const writable = overlayedFileSystems?.writable as IndexedDBFileSystem;
readable?.empty();
if (writable?.getName() === "InMemory") {
resolve();
} else {
writable?.empty((apiError) =>
apiError ? reject(apiError) : resolve()
);
}
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(apiError) =>
apiError ? reject(apiError) : resolve() | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(databases) => {
databases
.filter(({ name }) => name !== "browserfs")
.forEach(
({ name }) => name && window.indexedDB.deleteDatabase(name)
);
clearFs();
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
({ name }) => name !== "browserfs" | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
({ name }) => name && window.indexedDB.deleteDatabase(name) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
async (path: string): Promise<void> => {
const pathParts = path.split("/").filter(Boolean);
const recursePath = async (position = 1): Promise<void> => {
const makePath = join("/", pathParts.slice(0, position).join("/"));
let created: boolean;
try {
created = (await exists(makePath)) || (await mkdir(makePath));
} catch {
created = false;
}
if (created && position !== pathParts.length) {
await recursePath(position + 1);
}
};
await recursePath();
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
async (position = 1): Promise<void> => {
const makePath = join("/", pathParts.slice(0, position).join("/"));
let created: boolean;
try {
created = (await exists(makePath)) || (await mkdir(makePath));
} catch {
created = false;
}
if (created && position !== pathParts.length) {
await recursePath(position + 1);
}
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
async (path: string): Promise<void> => {
try {
await unlink(path);
} catch (error) {
if ((error as ApiError).code === "EISDIR") {
const dirContents = await readdir(path);
await Promise.all(
dirContents.map((entry) => deletePath(join(path, entry)))
);
await rmdir(path);
}
}
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(entry) => deletePath(join(path, entry)) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
async (
name: string,
directory: string,
buffer?: Buffer,
iteration = 0
): Promise<string> => {
const isInternal = !buffer && isAbsolute(name);
const baseName = isInternal ? basename(name) : name;
const uniqueName = !iteration
? baseName
: iterateFileName(baseName, iteration);
const fullNewPath = join(directory, uniqueName);
if (isInternal) {
if (
name !== fullNewPath &&
!directory.startsWith(name) &&
!rootFs?.mntMap[name]
) {
if (await exists(fullNewPath)) {
return createPath(name, directory, buffer, iteration + 1);
}
if (await rename(name, fullNewPath)) {
updateFolder(dirname(name), "", name);
}
return uniqueName;
}
} else {
try {
const baseDir = dirname(fullNewPath);
if (!(await exists(baseDir))) {
await mkdir(baseDir);
updateFolder(dirname(baseDir), basename(baseDir));
}
if (
buffer
? await writeFile(fullNewPath, buffer)
: await mkdir(fullNewPath)
) {
return uniqueName;
}
} catch (error) {
if ((error as ApiError)?.code === "EEXIST") {
return createPath(name, directory, buffer, iteration + 1);
}
}
}
return "";
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
async (): Promise<void> =>
Object.entries(await getFileSystemHandles()).forEach(
async ([handleDirectory, handle]) => {
if (!(await exists(handleDirectory))) {
mapFs(dirname(handleDirectory), handle);
}
}
) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
async ([handleDirectory, handle]) => {
if (!(await exists(handleDirectory))) {
mapFs(dirname(handleDirectory), handle);
}
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
() => {
restoreFsHandles();
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
() => {
const watchedPaths = Object.keys(fsWatchers).filter(
(watchedPath) => fsWatchers[watchedPath].length > 0
);
const mountedPaths = Object.keys(rootFs?.mntMap || {}).filter(
(mountedPath) => mountedPath !== "/"
);
mountedPaths.forEach((mountedPath) => {
if (
!watchedPaths.some((watchedPath) =>
watchedPath.startsWith(mountedPath)
) &&
rootFs?.mntMap[mountedPath]?.getName() !== "FileSystemAccess"
) {
rootFs?.umount?.(mountedPath);
}
});
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(watchedPath) => fsWatchers[watchedPath].length > 0 | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(mountedPath) => mountedPath !== "/" | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(mountedPath) => {
if (
!watchedPaths.some((watchedPath) =>
watchedPath.startsWith(mountedPath)
) &&
rootFs?.mntMap[mountedPath]?.getName() !== "FileSystemAccess"
) {
rootFs?.umount?.(mountedPath);
}
} | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ArrowFunction |
(watchedPath) =>
watchedPath.startsWith(mountedPath) | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
TypeAliasDeclaration |
type FilePasteOperations = Record<string, "copy" | "move">; | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
TypeAliasDeclaration |
export type FileSystemContextState = AsyncFS & {
addFile: (
directory: string,
callback: (name: string, buffer?: Buffer) => void
) => void;
addFsWatcher: (folder: string, updateFiles: UpdateFiles) => void;
copyEntries: (entries: string[]) => void;
createPath: (
name: string,
directory: string,
buffer?: Buffer
) => Promise<string>;
deletePath: (path: string) => Promise<void>;
fs?: FSModule;
mapFs: (directory: string) => Promise<string>;
mkdirRecursive: (path: string) => Promise<void>;
mountFs: (url: string) => Promise<void>;
moveEntries: (entries: string[]) => void;
pasteList: FilePasteOperations;
removeFsWatcher: (folder: string, updateFiles: UpdateFiles) => void;
resetStorage: () => Promise<void>;
rootFs?: RootFileSystem;
unMapFs: (directory: string) => void;
unMountFs: (url: string) => void;
updateFolder: (folder: string, newFile?: string, oldFile?: string) => void;
}; | shangkouyou/daedalOS | contexts/fileSystem/useFileSystemContextState.ts | TypeScript |
ClassDeclaration |
class Department
extends Model<DepartmentAttributes, DepartmentCreationAttributes>
implements DepartmentAttributes
{
id!: number;
name!: string;
creationDate!: Date;
members?: AdminMember[];
director?: AdminMember;
directorId?: number;
viceDirector?: AdminMember;
viceDirectorId?: number;
public static associations: {
members: Association<Department, AdminMember>;
director: Association<Department, AdminMember>;
viceDirector: Association<Department, AdminMember>;
};
public static initialize(sequelize: Sequelize) {
this.init(
{
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true,
},
name: {
type: DataTypes.STRING,
unique: true,
allowNull: false,
},
creationDate: {
type: DataTypes.DATEONLY,
defaultValue: DataTypes.NOW,
allowNull: false,
},
directorId: {
type: DataTypes.NUMBER,
allowNull: true,
references: {
// If we use AdminMember model directly, a cyclic reference will occur
model: 'AdminMembers',
key: 'memberId',
},
onDelete: 'SET NULL',
},
viceDirectorId: {
type: DataTypes.NUMBER,
allowNull: true,
references: {
// If we use AdminMember model directly, a cyclic reference will occur
model: 'AdminMembers',
key: 'memberId',
},
onDelete: 'SET NULL',
}
},
{
sequelize,
timestamps: false,
}
);
}
} | SysCPE/syscpe | backend/src/database/models/Department.ts | TypeScript |
InterfaceDeclaration |
interface DepartmentAttributes {
id: number;
name: string;
creationDate: Date;
directorId?: number;
viceDirectorId?: number;
members?: AdminMember[];
director?: AdminMember;
viceDirector?: AdminMember;
} | SysCPE/syscpe | backend/src/database/models/Department.ts | TypeScript |
InterfaceDeclaration |
interface DepartmentCreationAttributes
extends Optional<DepartmentAttributes, 'id'> {} | SysCPE/syscpe | backend/src/database/models/Department.ts | TypeScript |
MethodDeclaration |
public static initialize(sequelize: Sequelize) {
this.init(
{
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true,
},
name: {
type: DataTypes.STRING,
unique: true,
allowNull: false,
},
creationDate: {
type: DataTypes.DATEONLY,
defaultValue: DataTypes.NOW,
allowNull: false,
},
directorId: {
type: DataTypes.NUMBER,
allowNull: true,
references: {
// If we use AdminMember model directly, a cyclic reference will occur
model: 'AdminMembers',
key: 'memberId',
},
onDelete: 'SET NULL',
},
viceDirectorId: {
type: DataTypes.NUMBER,
allowNull: true,
references: {
// If we use AdminMember model directly, a cyclic reference will occur
model: 'AdminMembers',
key: 'memberId',
},
onDelete: 'SET NULL',
}
},
{
sequelize,
timestamps: false,
}
);
} | SysCPE/syscpe | backend/src/database/models/Department.ts | TypeScript |
ArrowFunction |
() => {
it('works', () => {
expect(searchUsageBoundary('', 0).content)
.toMatchInlineSnapshot('""')
expect(searchUsageBoundary('<div class="p-1 p-2', 14).content)
.toMatchInlineSnapshot('"p-1"')
expect(searchUsageBoundary('<div :class="`p-1 p-2', 16).content)
.toMatchInlineSnapshot('"p-1"')
expect(searchUsageBoundary('<div p-1 p-2>', 10).content)
.toMatchInlineSnapshot('"p-2"')
expect(searchUsageBoundary('.a{ @apply p-2; }', 14).content)
.toMatchInlineSnapshot('"p-2"')
})
} | UltraCakeBakery/unocss | test/autocomplete-utils.test.ts | TypeScript |
ArrowFunction |
() => {
expect(searchUsageBoundary('', 0).content)
.toMatchInlineSnapshot('""')
expect(searchUsageBoundary('<div class="p-1 p-2', 14).content)
.toMatchInlineSnapshot('"p-1"')
expect(searchUsageBoundary('<div :class="`p-1 p-2', 16).content)
.toMatchInlineSnapshot('"p-1"')
expect(searchUsageBoundary('<div p-1 p-2>', 10).content)
.toMatchInlineSnapshot('"p-2"')
expect(searchUsageBoundary('.a{ @apply p-2; }', 14).content)
.toMatchInlineSnapshot('"p-2"')
} | UltraCakeBakery/unocss | test/autocomplete-utils.test.ts | TypeScript |
ArrowFunction |
element => {
let scenario: Scenario = new Scenario(element);
if (scenario.isBackground()) {
this.background = scenario
} else {
this.scenarios.push(scenario);
}
if (scenario.isScenarioOutline()) {
this.hasScenarioOutline = true;
}
} | pragma81/kites | app/models/Feature.ts | TypeScript |
ArrowFunction |
(value, index, array): boolean => {
return !value.isBackground() && value.isAuto();
} | pragma81/kites | app/models/Feature.ts | TypeScript |
ArrowFunction |
(value, index, array): boolean => {
return value.isSmoke();
} | pragma81/kites | app/models/Feature.ts | TypeScript |
ArrowFunction |
(value, index, array): boolean => {
return value.isBasic();
} | pragma81/kites | app/models/Feature.ts | TypeScript |
ArrowFunction |
(value, index, array): boolean => {
return value.isAcceptance();
} | pragma81/kites | app/models/Feature.ts | TypeScript |
ArrowFunction |
(scenario) => {
return scenario.getSummary().toLowerCase().indexOf(criteria.toLowerCase()) > -1
} | pragma81/kites | app/models/Feature.ts | TypeScript |
ArrowFunction |
(value, index, array) => {
let valueAny: any = value;
this.tags.push(<string>valueAny.name)
} | pragma81/kites | app/models/Feature.ts | TypeScript |
InterfaceDeclaration |
export interface GherkinAST {
ast:any
} | pragma81/kites | app/models/Feature.ts | TypeScript |
EnumDeclaration |
export enum FeatureType {
API,
UI
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public hasBackground(): boolean {
return this.background != null
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getId(): string {
return this._id;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getName(): string {
return this.name;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getDescription(): string {
return this.description;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getProcessId(): string {
return this.processId;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getTCMId(): string {
return this.tcmId;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getType(): FeatureType {
return this.type;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getFileInfo(): FileInfo {
return this.fileInfo;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getScenarios(): Array<Scenario> {
return this.scenarios;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public isUI(): boolean {
return this.type == FeatureType.UI;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public isAPI(): boolean {
return this.type == FeatureType.API;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getTestSuiteName(): string {
return this.testSuiteName;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public setTestSuiteName(value: string) {
this.testSuiteName = value;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getRevision(): string {
return this._rev;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration | /*
TODO need to limit such method to be used by internal repository class only.
*/
public setRevision(revision: string) {
return this._rev = revision;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getBackground(): Scenario {
return this.background;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getTags(): Array<string> {
return this.tags;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public isTCMSynched() {
return this.tcmId != undefined
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getScenariosTotal(): number {
return this.scenarios.length
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getAutoScenariosTotal(): number {
let autoScenarios: Array<Scenario> = this.scenarios.filter((value, index, array): boolean => {
return !value.isBackground() && value.isAuto();
})
return autoScenarios.length;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getSmokeScenarios(): Array<Scenario> {
let smokeScenarios: Array<Scenario> = this.scenarios.filter((value, index, array): boolean => {
return value.isSmoke();
})
return smokeScenarios;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
MethodDeclaration |
public getBasicScenarios(): Array<Scenario> {
let basicScenarios: Array<Scenario> = this.scenarios.filter((value, index, array): boolean => {
return value.isBasic();
})
return basicScenarios;
} | pragma81/kites | app/models/Feature.ts | TypeScript |
Subsets and Splits