Socket
Socket
Sign inDemoInstall

append-snippet

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

append-snippet

Synchronously append a snippet of markup to an HTML document.


Version published
Maintainers
1
Created
Source

append-snippet

NPM version Linux Build Status Windows Build Status Dependency Status

A function that synchronously injects a snippet of markup into an HTML document, immediately before the closing </body> tag.

var appendSnippet = require('append-snippet');

var html = '<body>\n<h1>hello!</h1>\ndemo\n</body>';

var result = appendSnippet('<script>alert("cods")</script>', html);
// <body>\n<h1>hello!</h1>\ndemo\n<script>alert("cods")</script></body>

If there's no closing body tag, it goes just before the </html>, or failing that, the end of the string.

License

MIT © Callum Locke

FAQs

Package last updated on 11 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc