New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

append-children

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-children

Append things to a DOM element.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

append-children

Append children to a DOM element.

Install

With npm do:

npm install --save append-children

Usage

var appendChildren = require('append-children')
var element = document.createElement('div')

// append a single thing
appendChildren(element, document.createElement('p'))

// append multiple things
appendChildren(element, [
  // other DOM elements
  document.createElement('span'),
  // strings and friends
  'hello world',
  123,
  /regexes/gi,
  new Date(),
  // nested arrays of things to append
  [[[someOtherElement()]]]
])

function someOtherElement() {
  var hello = document.createElement('span')
  appendChildren(hello, 'hello')
  var world = document.createElement('strong')
  appendChildren(world, 'world')
  return [hello, ' ', world]
}

API

appendChildren(element, child)

Append a DOM element child to another DOM element element.

appendChildren(element, str)

Append a string str to a DOM element element. A Text node will be created to contain the string. RegExps, Dates and Numbers are converted to a string using toString().

appendChildren(element, arr)

Append multiple things to a DOM element element. arr can be an array of any of the things accepted by the other forms.

License

MIT

FAQs

Package last updated on 13 May 2017

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