Skip to content

Helper functions... #87

@njsfield

Description

@njsfield
function validateInput(query) {
  return query.replace(/[^a-z]/gi, '');
}

function makeRegExp(input) {
  return new RegExp('^' + input, 'i');
}

function match(list, regex) {
  return list.filter(function(word) { return regex.test(word); });
}

These are great! :) We used methods like these throughout our project but didn't think to wrap them in functions, nice :)
Perhaps put these into a 'helpers.js' file and require it in to files that need it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions