type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
() => { it('should create a new model file', async(() => { let b = new Blob( [`/**CTO File**/ namespace test`], {type: 'text/plain'} ); let file = new File([b], 'newfile.cto'); let dataBuffer = new Buffer('/**CTO File**/ namespace ...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let b = new Blob( [`/**CTO File**/ namespace test`], {type: 'text/plain'} ); let file = new File([b], 'newfile.cto'); let dataBuffer = new Buffer('/**CTO File**/ namespace test'); let mockModel = new ModelFile(mockModel...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let fileName = 'models/testFileName.cto'; component.addModelFileName = fileName; let b = new Blob( [`/**CTO File**/ namespace test`], {type: 'text/plain'} ); let file = new File([b], ''); let dataBuffer = ne...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { it('should create a new ACL file named permissions.acl', async(() => { let dataBuffer = new Buffer('/**RULE File**/ all the rules'); let filename = 'permissions.acl'; let mockRuleFile = sinon.createStubInstance(AclFile); mockClientService.createAclFile.re...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let dataBuffer = new Buffer('/**RULE File**/ all the rules'); let filename = 'permissions.acl'; let mockRuleFile = sinon.createStubInstance(AclFile); mockClientService.createAclFile.returns(mockRuleFile); // Run method component.createRul...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { it('should create a new query file named queries.qry', async(() => { let dataBuffer = new Buffer('/**QUERY File**/ query things'); let filename = 'queries.qry'; mockClientService.createQueryFile.returns(mockQueryFile); // Run method component...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let dataBuffer = new Buffer('/**QUERY File**/ query things'); let filename = 'queries.qry'; mockClientService.createQueryFile.returns(mockQueryFile); // Run method component.createQuery(dataBuffer); // Assertions component.fi...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { it('should establish a readme file', async(() => { let dataBuffer = new Buffer('/**README File**/ read all the things'); // Run method component.createReadme(dataBuffer); // Assertions component.fileType.should.equal('md'); compo...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let dataBuffer = new Buffer('/**README File**/ read all the things'); // Run method component.createReadme(dataBuffer); // Assertions component.fileType.should.equal('md'); component.currentFileName.should.equal('README.md'); ...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { it('should set current file to a script file, created by calling createScript with correct parameters', async(() => { let mockScript = sinon.createStubInstance(Script); mockScript.getIdentifier.returns('lib/script.js'); mockClientService.getScripts.returns([]); ...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let mockScript = sinon.createStubInstance(Script); mockScript.getIdentifier.returns('lib/script.js'); mockClientService.getScripts.returns([]); mockClientService.createScriptFile.returns(mockScript); component.fileType = 'js'; // Run meth...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let mockScript = sinon.createStubInstance(Script); let mockScript0 = sinon.createStubInstance(Script); let mockScript1 = sinon.createStubInstance(Script); mockScript.getIdentifier.returns('lib/script.js'); mockScript0.getIdentifier.returns('lib/script...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { mockClientService.getModelFiles.returns([]); let b = new Blob( [`/** * New model file */ namespace org.acme.model`], {type: 'text/plain'} ); let file = new File([b], 'models/org.acme.model.cto'); let dataBuffer = new...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let b = new Blob( [`/** * New model file */ namespace org.acme.model`], {type: 'text/plain'} ); let file = new File([b], 'org.acme.model.cto'); let dataBuffer = new Buffer(`/** * New model file */ namespace org.acme.model`);...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let mockFile = sinon.createStubInstance(ModelFile); mockFile.getNamespace.returns('org.acme.model'); let mockFile0 = sinon.createStubInstance(ModelFile); mockFile0.getNamespace.returns('org.acme.model0'); let mockFile1 = sinon.createStubInstance(Model...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let dataBuffer = new Buffer(`/** * New query file */`); let mockQuery = new QueryFile('queries.qry', mockQueryManager, dataBuffer.toString()); mockClientService.createAclFile.returns(mockQuery); component.fileType = 'qry'; component.changeCurrent...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let dataBuffer = new Buffer(`/** * New access control file */ rule AllAccess { description: "AllAccess - grant everything to everybody." participant: "org.hyperledger.composer.system.Participant" operation: ALL resource: "org.hyperledger.composer.system.**" action: ALL...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { it('should reset back to default values', async(() => { component.expandInput = true; component.currentFile = true; component.currentFileName = true; component.fileType = 'js'; // Run method component.removeFile(); //...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { component.expandInput = true; component.currentFile = true; component.currentFileName = true; component.fileType = 'js'; // Run method component.removeFile(); // Assertions component.expandInput.should.not.be.true...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let file; let mockFileReadObj; let mockBuffer; let mockFileRead; let content; beforeEach(() => { content = 'hello world'; let data = new Blob([content], {type: 'text/plain'}); file = new File([data], 'mock.bna'); ...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { content = 'hello world'; let data = new Blob([content], {type: 'text/plain'}); file = new File([data], 'mock.bna'); mockFileReadObj = { readAsArrayBuffer: sandbox.stub(), result: content, onload: sinon.stub(), ...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { mockFileRead.restore(); }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let promise = component.getDataBuffer(file); mockFileReadObj.onload(); return promise .then((data) => { // Assertions data.toString().should.equal(content); }); }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
(data) => { // Assertions data.toString().should.equal(content); }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let promise = component.getDataBuffer(file); mockFileReadObj.onerror('error'); return promise .then((data) => { // Assertions data.should.be.null; }) .catch((err) => { // Assertions ...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
(data) => { // Assertions data.should.be.null; }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
(err) => { // Assertions err.should.equal('error'); }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { it('should return true if an acl file is present', () => { let fileArray = []; fileArray.push({acl: true, id: 'acl file', displayID: 'acl0'}); fileArray.push({script: true, id: 'script 0', displayID: 'script0'}); component['files'] = fileArray; ...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let fileArray = []; fileArray.push({acl: true, id: 'acl file', displayID: 'acl0'}); fileArray.push({script: true, id: 'script 0', displayID: 'script0'}); component['files'] = fileArray; let result = component['aclExists'](); result.should...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let fileArray = []; fileArray.push({script: true, id: 'script 0', displayID: 'script0'}); fileArray.push({script: true, id: 'script 0', displayID: 'script1'}); component['files'] = fileArray; let result = component['aclExists'](); result....
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { it('should return true if a query file is present', () => { let fileArray = []; fileArray.push({query: true, id: 'query file', displayID: 'query0'}); fileArray.push({script: true, id: 'script 0', displayID: 'script0'}); component['files'] = fileArray; ...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let fileArray = []; fileArray.push({query: true, id: 'query file', displayID: 'query0'}); fileArray.push({script: true, id: 'script 0', displayID: 'script0'}); component['files'] = fileArray; let result = component['queryExists'](); resul...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ArrowFunction
() => { let fileArray = []; fileArray.push({script: true, id: 'script 0', displayID: 'script0'}); fileArray.push({script: true, id: 'script 0', displayID: 'script1'}); component['files'] = fileArray; let result = component['queryExists'](); resul...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ClassDeclaration
class MockAdminService { getAdminConnection(): AdminConnection { return new AdminConnection(); } ensureConnection(): Promise<any> { return new Promise((resolve, reject) => { resolve(true); }); } deploy(): Promise<any> { return new Promise((resolve, reje...
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
ClassDeclaration
class MockAlertService { public errorStatus$: Subject<string> = new BehaviorSubject<string>(null); public busyStatus$: Subject<string> = new BehaviorSubject<string>(null); }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
MethodDeclaration
getAdminConnection(): AdminConnection { return new AdminConnection(); }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
MethodDeclaration
ensureConnection(): Promise<any> { return new Promise((resolve, reject) => { resolve(true); }); }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
MethodDeclaration
deploy(): Promise<any> { return new Promise((resolve, reject) => { resolve(new BusinessNetworkDefinition('org-acme-biznet@0.0.1', 'Acme Business Network')); }); }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
MethodDeclaration
update(): Promise<any> { return new Promise((resolve, reject) => { resolve(new BusinessNetworkDefinition('org-acme-biznet@0.0.1', 'Acme Business Network')); }); }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
MethodDeclaration
generateDefaultBusinessNetwork(): BusinessNetworkDefinition { return new BusinessNetworkDefinition('org-acme-biznet@0.0.1', 'Acme Business Network'); }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
MethodDeclaration
isInitialDeploy(): boolean { return true; }
NunoEdgarGFlowHub/composer
packages/composer-playground/src/app/editor/add-file/add-file.component.spec.ts
TypeScript
FunctionDeclaration
export function queryEncode(data: Record<string, any>) { const queries: string[] = []; Object.entries(data).forEach(([key, value]) => { if (value !== undefined) { if (Array.isArray(value)) { value.forEach((val) => { queries.push(`${encodeURIComponent(key)}=${encodeURIComponent(val)}`); ...
Tolgee/server
webapp/src/hooks/useUrlSearchState.ts
TypeScript
FunctionDeclaration
export function queryDecode(url: string, forceArray = false) { const query = (url || '').substr(1); const result: Record<string, string | string[]> = {}; if (query) { query.split('&').forEach(function (part) { const item = part.split('='); const key = decodeURIComponent(item[0]); const valu...
Tolgee/server
webapp/src/hooks/useUrlSearchState.ts
TypeScript
ArrowFunction
([key, value]) => { if (value !== undefined) { if (Array.isArray(value)) { value.forEach((val) => { queries.push(`${encodeURIComponent(key)}=${encodeURIComponent(val)}`); }); } else { queries.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`); } ...
Tolgee/server
webapp/src/hooks/useUrlSearchState.ts
TypeScript
ArrowFunction
(val) => { queries.push(`${encodeURIComponent(key)}=${encodeURIComponent(val)}`); }
Tolgee/server
webapp/src/hooks/useUrlSearchState.ts
TypeScript
ArrowFunction
( key: string, options?: Options ): [ string | string[] | undefined, (value: string | string[] | undefined) => void ] => { const location = useLocation(); const value = queryDecode(location.search)[key]; const { replace, push } = useHistory(); const getNewSearch = useCallback( (value: any) => { ...
Tolgee/server
webapp/src/hooks/useUrlSearchState.ts
TypeScript
ArrowFunction
(value: any) => { const data = queryDecode(window.location.search); const newValue = value === options?.defaultVal ? undefined : value; const newSearch = queryEncode({ ...data, [key]: newValue, }); return newSearch; }
Tolgee/server
webapp/src/hooks/useUrlSearchState.ts
TypeScript
ArrowFunction
(value: any) => { const newSearch = getNewSearch(value); if (options?.history) { push(window.location.pathname + newSearch); } else { replace(window.location.pathname + newSearch); } }
Tolgee/server
webapp/src/hooks/useUrlSearchState.ts
TypeScript
ArrowFunction
() => { return () => { if (options?.cleanup) { setState(undefined); } }; }
Tolgee/server
webapp/src/hooks/useUrlSearchState.ts
TypeScript
ArrowFunction
() => { if (options?.cleanup) { setState(undefined); } }
Tolgee/server
webapp/src/hooks/useUrlSearchState.ts
TypeScript
TypeAliasDeclaration
type Options = { defaultVal?: string | string[]; history?: boolean; array?: boolean; // clear parameter from url, after unmount cleanup?: boolean; };
Tolgee/server
webapp/src/hooks/useUrlSearchState.ts
TypeScript
InterfaceDeclaration
export interface ictx extends RouterContext { session: iSession; }
cuo9958/nps-cms
src/extends.ts
TypeScript
InterfaceDeclaration
interface iSession { user: IUser; }
cuo9958/nps-cms
src/extends.ts
TypeScript
InterfaceDeclaration
interface IUser { id: number; user_type: number; username: string; nickname: string; uuid: string; }
cuo9958/nps-cms
src/extends.ts
TypeScript
FunctionDeclaration
function readFiles (sourcePath, originalFilePath) { readPromises.push(new Promise((resolve, reject) => { klaw(sourcePath) .on('data', file => { const REG_IGNORE = /(\\|\/)\.(svn|git)\1/i; const relativePath = path.relative(appPath, file.path) if (file.stats.i...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
FunctionDeclaration
export async function build (appPath: string, buildConfig: IBuildOptions, buildHooks: IBuildHooks) { process.env.TARO_ENV = 'h5' await checkCliAndFrameworkVersion(appPath, 'h5') const compiler = new Compiler(appPath) await compiler.clean() await compiler.buildTemp() if (compiler.h5Config.transformOnly !== ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
filePath => filePath.indexOf(path.dirname(path.join(appPath, PROJECT_CONFIG))) >= 0
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
([pageName, filePath]) => { const relPage = path.normalize( path.relative(appPath, pageName) ) if (path.relative(relPage, relSrcPath) === '') return true return false }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(resolve, reject) => { klaw(sourcePath) .on('data', file => { const REG_IGNORE = /(\\|\/)\.(svn|git)\1/i; const relativePath = path.relative(appPath, file.path) if (file.stats.isSymbolicLink()) { let linkFile = fs.readlinkSync(file.path) ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
file => { const REG_IGNORE = /(\\|\/)\.(svn|git)\1/i; const relativePath = path.relative(appPath, file.path) if (file.stats.isSymbolicLink()) { let linkFile = fs.readlinkSync(file.path) if (!path.isAbsolute(linkFile)) { linkFile = path.res...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
() => { resolve() }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(filename: string) => { return path.join(tempPath, filename) }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
([pagename, filePath]) => { return [filePath, [getEntryFile(filePath) + '.js']] }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
filePath => { const relativePath = path.relative(appPath, filePath) printLog(processTypeEnum.CREATE, '添加文件', relativePath) this.processFiles(filePath, filePath) }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
filePath => { const relativePath = path.relative(appPath, filePath) printLog(processTypeEnum.MODIFY, '文件变动', relativePath) this.processFiles(filePath, filePath) }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
filePath => { const relativePath = path.relative(appPath, filePath) const extname = path.extname(relativePath) const distDirname = this.getTempDir(filePath, filePath) const isScriptFile = REG_SCRIPTS.test(extname) const dist = this.getDist(distDirname, filePath, isScriptFile) ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(currentPagename: string, funcBody: string) => { const firstPage = first(pages) const homePage = firstPage ? firstPage[0] : '' const panel = ` <${tabBarPanelComponentName}> ${funcBody} </${tabBarPanelComponentName}>` const comp = ` <${tabBarComponentName} ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(funcBody: string) => { return ` <${providerImportName} store={${storeName}}> ${funcBody} </${providerImportName}> ` }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(funcBody: string) => { return `{return (${funcBody});}` }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(pages: [PageName, FilePath][]) => { const routes = pages.map(([pageName, filePath], k) => { const shouldLazyloadPage = typeof routerLazyload === 'function' ? routerLazyload(pageName) : routerLazyload return createRoute({ ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
([pageName, filePath], k) => { const shouldLazyloadPage = typeof routerLazyload === 'function' ? routerLazyload(pageName) : routerLazyload return createRoute({ pageName, lazyload: shouldLazyloadPage, ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
v => { if (t.isSpreadProperty(v)) return false return toVar(v.key) === 'root' }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(v: t.StringLiteral) => { const pagePath = `${root}/${v.value}`.replace(/\/{2,}/g, '/') const pageName = removeLeadingSlash(pagePath) pages.push([pageName, renamePagename(pageName).replace(/\//g, '')]) v.value = addLeadingSlash(v.value) }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(v: t.StringLiteral) => { const pagePath = v.value.replace(/\/{2,}/g, '/') const pageName = removeLeadingSlash(pagePath) pages.push([pageName, renamePagename(pageName).replace(/\//g, '')]) v.value = addLeadingSlash(v.value) }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(node) => { if (t.isSpreadProperty(node)) return switch (toVar(node.key)) { case 'position': tabbarPos = toVar(node.value) break case 'list': t.isArrayExpression(node.value) && node.value.elements.forEach(v => { ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
v => { if (!t.isObjectExpression(v)) return v.properties.forEach(property => { if (!t.isObjectProperty(property)) return switch (toVar(property.key)) { case 'iconPath': case 'selectedIconPath': ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
property => { if (!t.isObjectProperty(property)) return switch (toVar(property.key)) { case 'iconPath': case 'selectedIconPath': if (t.isStringLiteral(property.value)) { property.value ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(res, [pageName, filePath], key) => { res[addLeadingSlash(pageName)] = addLeadingSlash(filePath) }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(astPath: NodePath<t.ImportDeclaration>) => { const node = astPath.node const source = node.source const specifiers = node.specifiers if (source.value === '@tarojs/taro') { const specifier = specifiers.find(item => t.isImportDefaultSpecifier(item)) if (s...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
item => t.isImportDefaultSpecifier(item)
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
item => { return t.isImportSpecifier(item) && item.imported.name === providerComponentName }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(ast) => { return generate(ast, { jsescOption: { minimal: true } }).code }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
([pageName, filePath], k) => { const createFuncBody = () => { const shouldLazyloadPage = typeof routerLazyload === 'function' ? routerLazyload(pageName) : routerLazyload const route = createRoute({ pageName, lazyload: shouldLazyloadPage, ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
() => { const shouldLazyloadPage = typeof routerLazyload === 'function' ? routerLazyload(pageName) : routerLazyload const route = createRoute({ pageName, lazyload: shouldLazyloadPage, isIndex: k === 0 }) return ` ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(bodyNode) => { if (t.isExpressionStatement(bodyNode) && t.isCallExpression(bodyNode.expression) && t.isIdentifier(bodyNode.expression.callee) && bodyNode.expression.callee.name === 'mountApis') { const mountApisOptNode = bodyNode....
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(property: t.ObjectProperty) => { return toVar<string>(property.key) === 'currentPagename' }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(componentName: string, node: t.JSXOpeningElement) => { const idAttrName = MAP_FROM_COMPONENTNAME_TO_ID.get(componentName) return node.attributes.reduce((prev, attribute) => { if (prev) return prev const attrName = toVar(attribute.name) if (attrName === idAttrName) return toVar(attr...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(prev, attribute) => { if (prev) return prev const attrName = toVar(attribute.name) if (attrName === idAttrName) return toVar(attribute.value) else return false }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(node: t.JSXOpeningElement) => { return node.attributes.find(attribute => { return toVar(attribute.name) === 'ref' }) }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
attribute => { return toVar(attribute.name) === 'ref' }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(componentId: string) => { return t.arrowFunctionExpression( [t.identifier('ref')], t.blockStatement([ toAst(`this['__taroref_${componentId}'] = ref`) as t.Statement ]) ) }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(astPath: NodePath<t.ExportNamedDeclaration>) => { if (!astPath) return const node = astPath.node if (t.isFunctionDeclaration(node.declaration)) { astPath.replaceWithMultiple([ node.declaration, t.exportDefaultDeclaration(node.declaration.id) ]) } else if (...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(astPath: NodePath<t.ImportDeclaration>) => { const node = astPath.node const source = node.source const specifiers = node.specifiers if (source.value === '@tarojs/taro') { importTaroNode = node specifiers.forEach(specifier => { if (t.isImp...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
specifier => { if (t.isImportDefaultSpecifier(specifier)) { taroImportDefaultName = toVar(specifier.local) } else if (t.isImportSpecifier(specifier)) { taroapiMap.set(toVar(specifier.local), toVar(specifier.imported)) } }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(specifier) => { if (!t.isImportSpecifier(specifier)) return componentnameMap.set(toVar(specifier.local), toVar(specifier.imported)) }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
(p: NodePath<t.Node>) => p.isClassExpression() || p.isClassDeclaration()
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
specifier => { if (!t.isImportSpecifier(specifier)) return false const importedComponent = toVar(specifier.imported) return importedComponent === 'PullDownRefresh' }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
renderReturnStatementPath => { const funcParentPath: NodePath = renderReturnStatementPath.getFunctionParent() return funcParentPath.node === renderClassMethodNode }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
returnAstPath => { const statement = returnAstPath.node const varName = returnAstPath.scope.generateUid() const returnValue = statement.argument const pullDownRefreshNode = t.variableDeclaration( 'const', [t.variableDeclarator( ...
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript
ArrowFunction
([pageName, code]) => { fs.writeFileSync( path.join(distDirname, `${pageName}.js`), code ) }
CooperFu/taro
packages/taro-cli/src/h5/index.ts
TypeScript