How to use the escape-goat.escape function in escape-goat

To help you get started, we’ve selected a few escape-goat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github npmhub / npmhub / source / content.js View on Github external
async function addDependency(name, container) {
  const depEl = doma.one(`
    <li>
      <a href="https://www.npmjs.com/package/${esc(name)}">
        ${esc(name)}
      </a>
    </li>
  `);
  container.append(depEl);

  const {url, description, error} = await fetchPackageInfo(name);

  if (error) {
    if (error === 'Not found') {
      depEl.append(doma('<em>Not published or private.</em>'));
    } else {
      console.warn(`${errorMessage} fetching ${esc(name)}/package.json`, error);
      depEl.append(doma('<em>There was a network error.</em>'));
    }
github npmhub / npmhub / source / content.js View on Github external
async function addDependency(name, container) {
  const depEl = doma.one(`
    <li>
      <a href="https://www.npmjs.com/package/${esc(name)}">
        ${esc(name)}
      </a>
    </li>
  `);
  container.append(depEl);

  const {url, description, error} = await fetchPackageInfo(name);

  if (error) {
    if (error === 'Not found') {
      depEl.append(doma('<em>Not published or private.</em>'));
    } else {
      console.warn(`${errorMessage} fetching ${esc(name)}/package.json`, error);
      depEl.append(doma('<em>There was a network error.</em>'));
    }

    return;
github zeit / release / lib / pick-commit.js View on Github external
};

	for (const definition in toReplace) {
		if (!{}.hasOwnProperty.call(toReplace, definition)) {
			continue;
		}

		const state = toReplace[definition];

		if (state) {
			title = title.replace(`(${state})`, '');
		}
	}

	if (doEscapeHTML) {
		title = escapeGoat.escape(title);
	}

	return {
		content: capitalize(title).trim(),
		ref: toReplace.ref
	};
};
github mattmezza / vue-beautiful-chat / src / messages / TextMessage.vue View on Github external
messageText() {
      const escaped = escapeGoat.escape(this.data.text)

      return Autolinker.link(this.messageStyling ? fmt(escaped) : escaped, {
        className: 'chatLink',
        truncate: { length: 50, location: 'smart' }
      })
    }
  }
github npmhub / npmhub / source / content.js View on Github external
addHeaderLink(
      dependenciesBox,
      'npmjs.com',
      `https://www.npmjs.com/package/${esc(pkg.name)}`
    );
    addHeaderLink(
      dependenciesBox,
      'RunKit',
      `https://npm.runkit.com/${esc(pkg.name)}`
    );
    if (dependencies.length > 0) {
      addHeaderLink(
        dependenciesBox,
        'Visualize full tree',
        `http://npm.broofa.com/?q=${esc(pkg.name)}`
      );
    }
  }
}

escape-goat

Escape a string for use in HTML or the inverse

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis