Replace lodash and underscore type checks with native JavaScript
MSALReplaces _.isArray(x) with Array.isArray(x), _.isNull(x) with x === null, _.isUndefined(x) with x === undefined, _.isFunction(x) with typeof x === 'function' (and !_.isNull(x) with x !== null, and so on), and lodash's _.isFinite(x) with Number.isFinite(x). _.isBoolean(x) and _.isString(x) become typeof checks only where the type of x rules out a boxed new Boolean() or new String(), which both libraries accept, and underscore's _.isFinite(x) only where x is a number, since underscore also accepts numeric strings. In TypeScript, _.isFunction(x) is rewritten only where x is any, unknown or may be a function, since typeof narrows any other type to never where the library's guard keeps it callable. A call is left alone where a local binding shadows undefined, Array or Number.
org. openrewrite. javascript. migrate. lodash. LodashUnderscoreUtilmod run . --recipe= org. openrewrite. javascript. migrate. lodash. LodashUnderscoreUtilInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.