UNPKG

@alexaegis/common

Version:

Common utility functions

16 lines 788 B
import { ObjectKeyOrder } from './object-key-order.type.js'; /** * * Among multiple `matchers` like ['.*', 'b', '.*'], when trying to fit in * a `key`, which slot would maintain order the best? For example fitting * 'a' into the above matcher order, it should go to the left slot, but fitting * 'c' should make it go to the right slot. */ export declare const findMostSensibleMatch: (matchers: RegExp[], key: string) => number; export declare const findMostSensibleMatchIdeaTwo: (matchers: RegExp[], key: string) => number; /** * Creates a copy of an object with its keys ordered according to a * preferred ordering */ export declare const sortObject: <T extends object | unknown[]>(o: T, sortPreferences?: ObjectKeyOrder) => T; //# sourceMappingURL=sort-object.function.d.ts.map