fd-replace

1.0.0 • Public • Published

fd-replace

Build Status npm version

replace DOM element in a functional way.

Installation

npm install fd-replace --save

Usage

import elem from 'fd-elem';
import append from 'fd-append';
import replace from 'replace';
 
let appendtoBody = append(document.body),
h1 = elem('h1','meow'),
h2 = elem('h2', 'bow');
 
appendtoBody(h1);
  
replace(document.body,h2,h1);
 
assert.equal(document.body.lastChild.textContent, 'bow'); // True.

API

append :: parent -> oldNode -> newNode

A curried function that takes in:

  • parent -> Parent element in which the DOM must be replaced.

  • oldNode -> DOM element that is to be replaced.

  • newNode -> New DOM element.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    1

Package Sidebar

Install

npm i fd-replace

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • hemanth
  • schtoeffel