How to use the isObjectLiteralExpression function from typescript

Find comprehensive JavaScript typescript.isObjectLiteralExpression code examples handpicked from public code repositorys.

132
133
134
135
136
137
138
139
140
141
    var expression = decorator.expression;
    if (!typescript_1.isCallExpression(expression) || !expression.arguments || expression.arguments.length === 0) {
        return undefined;
    }
    var args = expression.arguments[0];
    return typescript_1.isObjectLiteralExpression(args) && args.properties ? args : undefined;
};
exports.getDecoratorName = function (decorator) {
    var expression = decorator.expression;
    if (typescript_1.isIdentifier(expression))
fork icon0
star icon0
watch icon1

9
10
11
12
13
14
15
16
17
18
function hasProperties(expr) {
    return !!(expr && expr.properties);
}
exports.hasProperties = hasProperties;
function objectLiteralExpression(expr) {
    return function_1.Maybe.lift(expr.arguments[0]).fmap(function (arg0) { return (arg0 && ts.isObjectLiteralExpression(arg0) ? arg0 : undefined); });
}
exports.objectLiteralExpression = objectLiteralExpression;
function withIdentifier(identifier) {
    return function_1.ifTrue(function (expr) { return ts.isIdentifier(expr.expression) && expr.expression.text === identifier; });
fork icon0
star icon0
watch icon1

302
303
304
305
306
307
308
309
310
311
// Remove Angular decorators from`Clazz.decorators = [...];`, or expression itself if all are
// removed.
function pickDecorationNodesToRemove(exprStmt, ngMetadata, checker) {
    const expr = expect(exprStmt.expression, ts.SyntaxKind.BinaryExpression);
    const literal = expect(expr.right, ts.SyntaxKind.ArrayLiteralExpression);
    if (!literal.elements.every(elem => ts.isObjectLiteralExpression(elem))) {
        return [];
    }
    const elements = literal.elements;
    const ngDecorators = elements.filter((elem) => isAngularDecorator(elem, ngMetadata, checker));
fork icon0
star icon0
watch icon1

Other functions in typescript

Sorted by popularity

function icon

typescript.SyntaxKind is the most popular function in typescript (82777 examples)