-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
934 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@embr-modules/periscope': patch | ||
--- | ||
|
||
(Scripting) Added `system.perspective.runJavaScriptBlocking()` and `system.perspective.runJavaScriptAsync()` functions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@embr-js/utils': minor | ||
--- | ||
|
||
(BREAKING) `toFunction` now throws an error if function parsing fails. This is a breaking change from the previous behavior. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@embr-js/utils': minor | ||
--- | ||
|
||
(`toFunction`) Add support for `async` function parsing. | ||
(`isAsyncFunction`) Add utility function for matching `async` functions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@embr-jvm/core-common': minor | ||
--- | ||
|
||
(BREAKING) `PyArgOverloadBuilder` now works with KTypes instead of KClasses. This is to allow for nullability checks (KType contains nullability information). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0aea4786559d872348974f18cb5af77e21147ca7c7d3001a8c8b705e24f67f7c,http://localhost:51307 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
export { default as isAsyncFunction } from './isAsyncFunction' | ||
export { default as isCSSVar } from './isCSSVar' | ||
export { default as isFunction } from './isFunction' | ||
export { default as readCSSVar } from './readCSSVar' | ||
export { | ||
default as toFunction, | ||
type UserScript, | ||
type UserScriptParams, | ||
default as toFunction, | ||
type UserScript, | ||
type UserScriptParams, | ||
} from './toFunction' | ||
export { default as transformProps, type PropTransform } from './transformProps' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './isAsyncFunction' |
35 changes: 35 additions & 0 deletions
35
libraries/javascript/utils/src/isAsyncFunction/isAsyncFunction.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { it, expect, describe } from 'vitest' | ||
|
||
import isFunction from '../../../../../libraries/javascript/utils/src/isAsyncFunction/isAsyncFunction' | ||
import isAsyncFunction from '../../../../../libraries/javascript/utils/src/isAsyncFunction/isAsyncFunction' | ||
|
||
describe('isAsyncFunction', () => { | ||
it('false if no arrow function', async () => { | ||
expect(isAsyncFunction('no arrow function here')).toBe(false) | ||
}) | ||
|
||
it('true if async arrow function', async () => { | ||
expect(isAsyncFunction('async () => arrow function here')).toBe(true) | ||
}) | ||
|
||
it('true if arrow function with extra spaces', async () => { | ||
expect(isFunction(' async () => arrow function here ')).toBe( | ||
true | ||
) | ||
}) | ||
|
||
it('true if arrow function with new lines', async () => { | ||
expect( | ||
isFunction(` async () => arrow | ||
function here `) | ||
).toBe(true) | ||
}) | ||
|
||
it('true if arrow function parameters', async () => { | ||
expect( | ||
isFunction( | ||
' async(parameter1, parameter2) => arrow function here ' | ||
) | ||
).toBe(true) | ||
}) | ||
}) |
4 changes: 4 additions & 0 deletions
4
libraries/javascript/utils/src/isAsyncFunction/isAsyncFunction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const expression = /^\s*async\s*\(([^)]*?)\)\s*=>/ | ||
export default function isAsyncFunction(string: string): boolean { | ||
return expression.test(string) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
const expression = /^[\s\S]*?\(([^)]*?)\)[\s\S]*?=>[\s\S]?([\s\S]*)$/ | ||
const expression = /^\s*(?:async\s*)?\(([^)]*?)\)\s*=>\s*([\s\S]*)$/ | ||
export default function isFunction(string: string): boolean { | ||
return expression.test(string) | ||
return expression.test(string) | ||
} |
Oops, something went wrong.