yarn add babel-plugin-sync --dev
With .babelrc
:
{
"plugins": [
"sync"
]
}
In:
class MyModule {
// $MakeMeSync
async read() {
await this.resolve('./file')
}
}
Out:
class MyModule {
async read() {
await this.resolve('./file')
}
readSync() {
this.resolveSync('./file')
}
}
We don't know if it's safe to make the return statement sync at all, you can use the await
keyword or // $MakeMeSync
explicitly.
class Foo {
// $MakeMeSync
async foo() {
- return this.bar()
+ return this.bar() // $MakeMeSync
}
}
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
babel-plugin-sync © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
github.com/egoist · GitHub @egoist · Twitter @_egoistlily