Recently I saw this functon. I mean specifically this line/syntax:
export const selectItemBySpecificId = (id: string):any => createSelector(
What kind of function is this?
I know functions like: function doSomething() { ... } // function delaration statement
let doSomething = function() { .. } // function expresion
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions
Full example (it's a NgRx Selector with parameter):
export const selectItemBySpecificId = (id: string):any => createSelector(
selectAllItems,
(data: any) => {
const result = data.filter((item: IItem) => iem.id === id);
if (result.length >= 1) {
return result[0];
}
return null;
}
);