Validate if partial exists

Hi there !! I’m trying validate if a partial exists, I thought in use this method from packages/ember-views/lib/system/lookup_partial.js

But don’t know how import that, someone could me send a example this?

You cannot import that module, the modules in Ember’s own source are hidden from the main applications module registry (for now :smiley_cat:).

Copying over the important parts of that implementation would be something like:

function parseUnderscoredName(templateName) {
  let nameParts = templateName.split('/');
  let lastPart = nameParts[nameParts.length - 1];

  nameParts[nameParts.length - 1] = `_${lastPart}`;

  return nameParts.join('/');
}

function hasPartial(owner, partialName) {
  return owner.hasRegistration(`template:${parseUnderscoredName(name)}`) || owner.hasRegistration(`template:${name}`);
}

As a developer you should know if partials are there, since it’s static files. Why do you want to check it? Also partial should be replace to componets that is more decouple.