Code Monkey home page Code Monkey logo

spel2js's People

Contributors

benmarch avatar christopherthielen avatar ukrbublik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spel2js's Issues

null expression not evaluating

suppose employe.id = null and expression = "employe.id ? true : false"
if I am trying to evaluate the above expression using SpelExpressionEvaluator.compile(expression) function call. It returns NullPointer exception which was not happening in 0.2.5

Imports do not work on angular 13

Using angular 13 i get the following error:
Could not find a declaration file for module 'spel2js'
when trying to import as:
import { StandardContext, SpelExpressionEvaluator } from 'spel2js';

I was using const spel2js = require('spel2js'); with angular 12 but it does not work on 13 (and i don't know why).

It seems the solution is for you to provide something like @types/spel2js

class method cannot be evaluated

Hi,

I have a custom class that is existed some variables. I wrote a method that takes a variable inside it and want to evaluate with spel2js. But, I take an error as shown below

"TypeError: Cannot read property 'activeContext' of undefined"

I also share symbolic codes below.

//Class
export class Clazz{
//variables
//method
public foo(variable:string) : string{
//business Logic
}
}

const spelContext = StandardContext.create();
const compiledExpression = SpelExpressionEvaluator.compile("#foo('123') == '123'");
let result = compiledExpression.eval(spelContext, this.clazz);

Throw exception when use multiple safe navigation operator

Hi there, very useful library, Thank you, all!

I got one problem when i use safe navigation.
when i use multi ?. operators like:

"nested?.doesNotExist?.test"

will throw exception:

ContextDoesNotExistException: Attempting to look up property 'test' for an undefined context.

So is this a bug or i have some misunderstanding about safe navigation ?

Method references does not work

Hi,

I'm using Angular 8 for frontend. I have an expression and object for evaluating. For example expression is "(getSubFoo()!=null && getSubFoo() == 'XYZ')" and object is
export class Foo{
field1: string;
field2:string;
public getSubFoo(): string{
// some implementations
}
}

When i want to run above evaluation, evaluation drops to catch and error is message: "Method getSubFoo does not exist."
name: "NullPointerException".

Does spel2js provide to evaluate methods?

Best Regards,
Burak Mert.

object.property throws null pointer exception.

object.property throws null pointer exception when object is defined and there is no property.
Ideally it should not throw an exception instead return null or undefined.

example:
let obj = {a: 1, b: 2} is present in the context
and when I try to evaluate the expression like "obj.c == 3 ? true : false" it throws null pointer exception.

I can see nullSafeNavigation is false for me. is there a way I can make it true so that it returns null.

Expression with negative value failed to compile

spel2js failed to compile expression with negative value
version: 0.2.6

test('test', () => {
    let c = spel2js.SpelExpressionEvaluator.compile('1.0 > -5000.0')  // fail to compile
    console.log(c);
})

// test failed
// Cannot read property 'setParent' of undefined

`contains` method is not working.

When I am trying to evaluate the following expression:

{'PHONE','EMPLOYMENT_PHONE','WORK_PHONE'}.contains(classification)

Error is threw:
image

It looks that the contains method is not supported

Here I leave all data needed to reproduce it:

import { SpelExpressionEvaluator } from 'spel2js';

const context = {
    classification: 'PHONE',
};
const expr = `{'PHONE','EMPLOYMENT_PHONE','WORK_PHONE'}.contains(classification)`;
const compiledPrecondition = SpelExpressionEvaluator.compile(expr);
const result = compiledPrecondition.eval(context);

Request to push new version to npm

Hi - very useful library, thanks!

If you are ready to do so - are you able to push a new version (0.2.4 I guess) to NPM? There seems to be some packaging issue we have with the published 0.2.3 version that appears to be resolved on HEAD; possibly due to the switch to webpack; but that doesn't seem to be released yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.