File tree 1 file changed +16
-2
lines changed
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
import basepath from 'path' ;
2
- import { isString , isUrl } from './assertion' ;
2
+ import { isUrl } from './assertion' ;
3
3
import { getExtension } from './extension' ;
4
4
import { getFileInfo } from './file' ;
5
5
@@ -8,8 +8,22 @@ import { getFileInfo } from './file';
8
8
type Path = typeof basepath ;
9
9
const path = { } as Path ;
10
10
11
+ const isFunction = ( val : any ) => typeof val == 'function' ;
12
+
13
+ const isString = ( val : any ) => {
14
+ if ( typeof val === 'string' ) {
15
+ return true ;
16
+ }
17
+
18
+ if ( typeof val === 'object' && val !== null ) {
19
+ return Object . toString . call ( val ) == '[object String]' ;
20
+ }
21
+
22
+ return false ;
23
+ } ;
24
+
11
25
Object . entries ( basepath ) . forEach ( ( [ propName , propValue ] ) => {
12
- if ( typeof propValue === 'function' ) {
26
+ if ( isFunction ( propValue ) ) {
13
27
// @ts -ignore
14
28
path [ propName ] = ( ( propName ) => {
15
29
return ( ...args : any [ ] ) => {
You can’t perform that action at this time.
1 commit comments
vercel[bot] commentedon Jan 15, 2023
Successfully deployed to the following URLs:
orval – ./
orval.vercel.app
orval-git-master-anymaniax.vercel.app
orval.dev
www.orval.dev
orval-anymaniax.vercel.app