code: public function getConditionalDotJsInsertForValue($thenInsert, $elseInsert, array $additionalVarNameParts = []) {
          $fullName = $this->getVarNameForDotJs();
          $parts = array_merge(explode('.', $fullName), $additionalVarNameParts);
          $conditions = [];
          $chain = 'it';
          for ($i = 1, $cnt = count($parts); $i < $cnt; $i++) {
              $chain .= '.' . $parts[$i];
              $conditions[] = '!!' . $chain;
          }
          return '{{? ' . implode(' && ', $conditions) . '}}' . $thenInsert  . '{{??}}' . $elseInsert . '{{?}}';
      }
docs: Get failsafe conditional value insert for doT.js
  Conditional insert looks like:
  {{? !!it.viewer_name }}$thenInsert{{??}}$elseInsert{{?}} but more complicated to provide failsafe insert
  @param string $thenInsert - insert this data when condition is positive
  @param string $elseInsert - insert this data when condition is negative
  @param array $additionalVarNameParts - additional parts of var name
  @return string
  @throws \PeskyCMF\Scaffold\ValueViewerConfigException