mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-10-31 15:57:30 +03:00 
			
		
		
		
	chore: run prettier
This commit is contained in:
		
							parent
							
								
									b41b181dd0
								
							
						
					
					
						commit
						2ff726649c
					
				|  | @ -33,7 +33,10 @@ export class RequestSamples extends React.Component<RequestSamplesProps> { | ||||||
|             </TabList> |             </TabList> | ||||||
|             {hasBodySample && ( |             {hasBodySample && ( | ||||||
|               <TabPanel key="payload"> |               <TabPanel key="payload"> | ||||||
|                 <div> <PayloadSamples content={requestBodyContent!} /> </div> |                 <div> | ||||||
|  |                   {' '} | ||||||
|  |                   <PayloadSamples content={requestBodyContent!} />{' '} | ||||||
|  |                 </div> | ||||||
|               </TabPanel> |               </TabPanel> | ||||||
|             )} |             )} | ||||||
|             {samples.map(sample => ( |             {samples.map(sample => ( | ||||||
|  |  | ||||||
|  | @ -41,14 +41,14 @@ describe('Utils', () => { | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     test('slugifyIfAvailable returns original value when cannot slugify the value', () => { |     test('slugifyIfAvailable returns original value when cannot slugify the value', () => { | ||||||
|       const willBeSlugifed = safeSlugify('some string') |       const willBeSlugifed = safeSlugify('some string'); | ||||||
|       expect(willBeSlugifed).toEqual('some-string'); |       expect(willBeSlugifed).toEqual('some-string'); | ||||||
| 
 | 
 | ||||||
|       const cannotBeSlugified = '가나다라 마바사' |       const cannotBeSlugified = '가나다라 마바사'; | ||||||
|       // if slugify() fixes this issue, safeSlugify should be removed and replaced with original one.
 |       // if slugify() fixes this issue, safeSlugify should be removed and replaced with original one.
 | ||||||
|       expect(slugify(cannotBeSlugified)).toEqual(''); |       expect(slugify(cannotBeSlugified)).toEqual(''); | ||||||
|       expect(safeSlugify(cannotBeSlugified)).toEqual('가나다라-마바사'); |       expect(safeSlugify(cannotBeSlugified)).toEqual('가나다라-마바사'); | ||||||
|     }) |     }); | ||||||
| 
 | 
 | ||||||
|     describe('mergeObjects', () => { |     describe('mergeObjects', () => { | ||||||
|       test('should merge Objects and all nested Ones', () => { |       test('should merge Objects and all nested Ones', () => { | ||||||
|  |  | ||||||
|  | @ -121,11 +121,15 @@ const isMergebleObject = (item): boolean => { | ||||||
|  * the regex codes are referenced with https://gist.github.com/mathewbyrne/1280286
 |  * the regex codes are referenced with https://gist.github.com/mathewbyrne/1280286
 | ||||||
|  */ |  */ | ||||||
| export function safeSlugify(value: string): string { | export function safeSlugify(value: string): string { | ||||||
|   return slugify(value) || |   return ( | ||||||
|     value.toString().toLowerCase() |     slugify(value) || | ||||||
|  |     value | ||||||
|  |       .toString() | ||||||
|  |       .toLowerCase() | ||||||
|       .replace(/\s+/g, '-') // Replace spaces with -
 |       .replace(/\s+/g, '-') // Replace spaces with -
 | ||||||
|       .replace(/&/g, '-and-') // Replace & with 'and'
 |       .replace(/&/g, '-and-') // Replace & with 'and'
 | ||||||
|       .replace(/\--+/g, '-') // Replace multiple - with single -
 |       .replace(/\--+/g, '-') // Replace multiple - with single -
 | ||||||
|       .replace(/^-+/, '') // Trim - from start of text
 |       .replace(/^-+/, '') // Trim - from start of text
 | ||||||
|       .replace(/-+$/, '');          // Trim - from end of text
 |       .replace(/-+$/, '') | ||||||
|  |   ); // Trim - from end of text
 | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user