Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to override how properties are initialized #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add ability to override how properties are initialized #28

wants to merge 1 commit into from

Conversation

bradparks
Copy link

I wanted to be able to use text variables names as the actual variable values, and am suggesting the following simple way of doing so - by adding a callback that can replace the prop function.

Example usage:
This example will return true or false, if the search string matches the input text.

e.g.
"hi and there and (this or dog)" => returns 1
"hi and black and (this or dog)" => returns 0

  var testString = "hi there how are you?\nthis is another day";

  function mapIt(obj, name)
  {
    var result = testString.indexOf(name) != -1;
    return result;
  }

  try {
    var searchFcn = compileExpression(expression, additionalFunctions, mapIt); // <-- Filtrex!
    input.css('background-color', '#dfd');
  } catch (e) {
    // Failed to parse expression. Dont search
    input.css('background-color', '#fdd');
    return;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants