Socket
Book a DemoInstallSign in
Socket

fd-replace

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

fd-replace

replace DOM element in a functional way.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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.

Keywords

fp-dom

FAQs

Package last updated on 16 Mar 2015

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