Utils in Ember FW

Utils is short for Utilities, and they are essentially whatever you need them to be. It is simply a way to import a function that does a certain task. In Ember FW, we have a few utils files that have been defined, and each has several different functions that are semi-related to each other. Each one of these util files has a separate import statement to be used, and can import several different functions. For details on how to use each of these functions, please click the link to the API Docs, which discusses that Utility. Here are the three groups of utils it defines:

  • The Computed util defines common computed properties which can be imported, so that they do not need to be defined every time they need to be used. This util includes the following functions: filterByKeys, sortBy, and storePeekAll.
  • The Error util defines a few functions which can aid in displaying errors, using the Notifications service. The error handling functions it defines includes: createErrorLink, createErrorMessage, and handleAjaxError.
  • The Two Way Binding util defines a couple of computed properties which can be used with more complicated data to still display it accurately using Query Params. These include: momentToString, modelToId, and modelsToIds.