[][src]Module rslint_core::util

General utilities to make linting easier.

Functions

constructor_or_call_with_callee

Check if this is either a Call expression with the callee of name, or if this is a New expression with a callee of name. e.g. Boolean() or new Boolean()

find_best_match_for_name

Find the best match for a string in an iterator of strings based on levenshtein distance.

get_assignment_expr_value

Expands an assignment to the returned value, e.g. foo += 5 -> foo + 5, foo = 6 -> 6

is_const

Check whether an expr is constant and is always falsey or truthy

is_const_ident

Whether this is a predefined constant identifier such as NaN and undefined

levenshtein_distance

Find the Levenshtein distance between two strings

multi_node_range

Get the combined range of multiple nodes.

outer_function

Get the first enclosing function of a node, this does not consider if the node itself is a function.

simple_bool_coerce

Attempt to check if a simple expression is always truthy or always falsey.

simple_const_condition_context

Issue more context around the effects of a constant condition on a node.

string_token_eq

Compare two lists of tokens by comparing their underlying string value.

token_list_range

Get the range represented by a list of tokens.