An open API service indexing awesome lists of open source software.

https://github.com/fernandocode/lambda-expression

Lambda Expression for TypeScript
https://github.com/fernandocode/lambda-expression

lambda-expressions typescript

Last synced: 3 months ago
JSON representation

Lambda Expression for TypeScript

Awesome Lists containing this project

README

          

[![npm version](https://badge.fury.io/js/lambda-expression.svg/?a=1)](https://www.npmjs.com/package/lambda-expression)

# lambda-expression

Utility to analyze function (js) and arrow functions (ts), and create metadata of expressions, the initial scope is that it seeks to solve simple expressions. And later advance to encompass complex expressions.

Created use to Typescript

## Usage

First, install the package using npm:

npm install lambda-expression --save

In Typescript:

import { ExpressionUtils, Expression } from "lambda-expression";

export class ExpressionUsage {

private readonly _expressionUtils: ExpressionUtils;

constructor() {
this._expressionUtils = new ExpressionUtils();
}

public expression(exp: Expression){
console.log(this._expressionUtils.getColumnByExpression(exp));
}

public test(){
this.expression(x => x.id); // id
this.expression(x => x.description); // description
this.expression(x => x.date); // date
this.expression(x => x.isValid); // isValid
this.expression(x => x.reference.name); // reference_name
}
}

class ModelTest{
id: number;
name: string;
description: string;
date: Date;
isValid: boolean;
reference: ReferencesModelTest;
}

class ReferencesModelTest{
id: number;
name: string;
}

## License

Apache 2.0