📜  接口方法扩展 angular - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:15.979000             🧑  作者: Mango

代码示例1
interface ArrayConstructor {
    sortAlphaNumeric: (data: Array) => Array;
};

Array.sortAlphaNumeric = function (data): Array {
    return data.sort((a, b) => {
        return a.AreaName.toLowerCase().localeCompare(b.AreaName.toLowerCase(), undefined, {
            numeric: true,
            sensitivity: 'base'
        });
    });
}