Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > LegacyAdapters

LegacyAdapters class

Helper functions used when interacting with APIs that do not follow modern coding practices.

Signature:

export declare class LegacyAdapters 

Methods

MethodModifiersDescription
convertCallbackToPromise(fn)staticThis function wraps a function with a callback in a promise.
convertCallbackToPromise(fn, arg1)static
convertCallbackToPromise(fn, arg1, arg2)static
convertCallbackToPromise(fn, arg1, arg2, arg3)static
convertCallbackToPromise(fn, arg1, arg2, arg3, arg4)static
scrubError(error)staticNormalizes an object into an Error object.
sortStable(array, compare)staticPrior to Node 11.x, the Array.sort() algorithm is not guaranteed to be stable. If you need a stable sort, you can use sortStable() as a workaround.