Skip to content

Instantly share code, notes, and snippets.

@ianjennings
Created July 31, 2020 14:12
Show Gist options
  • Save ianjennings/30eadd63253b51933867a2dc8f0d2c60 to your computer and use it in GitHub Desktop.
Save ianjennings/30eadd63253b51933867a2dc8f0d2c60 to your computer and use it in GitHub Desktop.
{
"type": "File",
"start": 0,
"end": 73,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 0
}
},
"errors": [],
"program": {
"type": "Program",
"start": 0,
"end": 73,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 0
}
},
"sourceType": "script",
"interpreter": null,
"body": [{
"type": "ExpressionStatement",
"start": 0,
"end": 72,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 0,
"end": 71,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 2
}
},
"callee": {
"type": "MemberExpression",
"start": 0,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 36
}
},
"object": {
"type": "CallExpression",
"start": 0,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 28
}
},
"callee": {
"type": "MemberExpression",
"start": 0,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 18
}
},
"object": {
"type": "Identifier",
"start": 0,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
},
"identifierName": "Promise"
},
"name": "Promise"
},
"property": {
"type": "Identifier",
"start": 8,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "allSettled"
},
"name": "allSettled"
},
"computed": false
},
"arguments": [{
"type": "ArrayExpression",
"start": 19,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 27
}
},
"elements": [{
"type": "Identifier",
"start": 20,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 22
},
"identifierName": "p1"
},
"name": "p1"
}, {
"type": "Identifier",
"start": 24,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 26
},
"identifierName": "p2"
},
"name": "p2"
}]
}]
},
"property": {
"type": "Identifier",
"start": 29,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 36
},
"identifierName": "finally"
},
"name": "finally"
},
"computed": false
},
"arguments": [{
"type": "ArrowFunctionExpression",
"start": 37,
"end": 70,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 3,
"column": 1
}
},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 43,
"end": 70,
"loc": {
"start": {
"line": 1,
"column": 43
},
"end": {
"line": 3,
"column": 1
}
},
"body": [{
"type": "ExpressionStatement",
"start": 47,
"end": 68,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 23
}
},
"expression": {
"type": "CallExpression",
"start": 47,
"end": 67,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 22
}
},
"callee": {
"type": "MemberExpression",
"start": 47,
"end": 58,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 13
}
},
"object": {
"type": "Identifier",
"start": 47,
"end": 54,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 9
},
"identifierName": "console"
},
"name": "console"
},
"property": {
"type": "Identifier",
"start": 55,
"end": 58,
"loc": {
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 13
},
"identifierName": "log"
},
"name": "log"
},
"computed": false
},
"arguments": [{
"type": "StringLiteral",
"start": 59,
"end": 66,
"loc": {
"start": {
"line": 2,
"column": 14
},
"end": {
"line": 2,
"column": 21
}
},
"extra": {
"rawValue": "Done!",
"raw": "\"Done!\""
},
"value": "Done!"
}]
}
}],
"directives": []
}
}]
}
}],
"directives": []
},
"comments": []
}
import { parse } from '@babel/parser'
console.log('ast raw value', parse(source))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment