lave icon indicating copy to clipboard operation
lave copied to clipboard

Support serializing Async functions

Open balazsnemeth opened this issue 7 years ago • 0 comments

Tried to serialized an async function, and get this error:

UnhandledPromiseRejectionWarning: TypeError: Function.prototype.toString requires that 'this' be a Function
    at AsyncFunction.toString (<anonymous>)
    at String (<anonymous>)
    at isNativeFunction (/Users/nbalazs/Work/projects/stylers/Meta/MetaBase.CLI/MigrateMetadata/node_modules/lave/index.js:386:16)
    at getExpression (/Users/nbalazs/Work/projects/stylers/Meta/MetaBase.CLI/MigrateMetadata/node_modules/lave/index.js:155:13)
    at getExpression (/Users/nbalazs/Work/projects/stylers/Meta/MetaBase.CLI/MigrateMetadata/node_modules/lave/index.js:294:27)
    at getExpression (/Users/nbalazs/Work/projects/stylers/Meta/MetaBase.CLI/MigrateMetadata/node_modules/lave/index.js:269:25)
    at getExpression (/Users/nbalazs/Work/projects/stylers/Meta/MetaBase.CLI/MigrateMetadata/node_modules/lave/index.js:190:25)
    at getExpression (/Users/nbalazs/Work/projects/stylers/Meta/MetaBase.CLI/MigrateMetadata/node_modules/lave/index.js:269:25)
    at lave (/Users/nbalazs/Work/projects/stylers/Meta/MetaBase.CLI/MigrateMetadata/node_modules/lave/index.js:13:20)
    at main (/Users/nbalazs/Work/projects/stylers/Meta/MetaBase.CLI/MigrateMetadata/break_metadata.js:117:24)

Example function:

const fn = async (args) => {
                console.log(args.entities);
                for (const entity of args.entities) {
                    if (entity.Name) {
                        entity.Name = 'SS_' + entity.Name;
                    }
                }
                return await commit();
            }

balazsnemeth avatar Jun 11 '18 18:06 balazsnemeth