Skip to content

canCreate() is not a function error. #532

Closed
@YevSent

Description

@YevSent

I have a strange behavior for canCreate() function.
For example, when plugin was initialized - create option is set to false But if later in code change it to true - I get self.canCreate() is not a function error.
I think this error holds because canCreate function is declared only if create setted to true when plugin is initializing.

if (self.settings.create) {
    self.canCreate = function(input) {
        var filter = self.settings.createFilter;
        return input.length
            && (typeof filter !== 'function' || filter.apply(self, [input]))
            && (typeof filter !== 'string' || new RegExp(filter).test(input))
            && (!(filter instanceof RegExp) || filter.test(input));
    };
}

I think, the canCreate() function must be declared always. What do you think about this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions