You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
361 B
JavaScript
16 lines
361 B
JavaScript
"use strict";
|
|
|
|
const types = require("@babel/types");
|
|
|
|
module.exports = function objectLiteral(entries) {
|
|
return types.objectExpression(
|
|
entries.map(([ key, value ]) => {
|
|
if (typeof key === "string") {
|
|
return types.objectProperty(types.stringLiteral(key), value, false);
|
|
} else {
|
|
return types.objectProperty(key, value, true);
|
|
}
|
|
})
|
|
);
|
|
};
|