You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@evolv/mutate

Package Overview
Dependencies
Maintainers
7
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evolv/mutate

A library of standard DOM mutations by Evolv AI.

2.4.1
latest
npmnpm
Version published
Maintainers
7
Created
Source

Mutate

Mutate is a library of helpers to maintain persistent modifications to the rendered DOM of a web page for implementation of temporary, experimental changes and features for rapid experimentation.

It is intended to be framework independent and equally effective for SPAs and traditionally rendered webpages.

Getting Set Up

Installation

$ npm install @evolv/mutate

Building From Source

Clone the repository and run the following commands.

$ npm install
$ npm run build

Run Demo Website

There is a demo site included.

Content warning: flashing lights

$ npm run demo

Getting Started

The API for Mutate is similar in a lot of ways to the API of jQuery with a significant difference, that is selectors (Collectors) refer to all current and future matching Elements, and the functions to modify the DOM (Mutations) are persistent.

This means that you don't need to worry about timing, or dynamic areas of the rendered page.

Mutate also provides the ability to "project" Elements of the DOM into other Elements of the DOM, binding all interactions with the "projection" back to the original Elements.

As everyone building variants have learned the hard way, most Elements are dependent on their location in the DOM for both style and functionality. Projection allows the implementer to "move" and restyle Elements without losing the position dependent functionality of the original Elements.

Importing

import {collect, mutate} from '@evolv/mutate';

Basic Usage

The basic flow when using Mutate is to first define a Collector.

collect('<selector>', '<collector name>');

Then to define a Mutator for the Collector.

mutate('<collector name>').hide();

Mutators allow for Mutations to be chained together, similar to jQuery which will be evaluated in order of invocation.

mutate('<collector name>').text('<new text value>').classes({'<new class>': true});

How to test your changes

  • Run npm start
  • Create a simple website or use codesandbox
  • Add a snippet to head <script src="http://localhost:8080/index.js"></script> (make sure that your local is running on 8080, otherwise update src)
  • Apply changes to the website in the console
evolv.collect('h1', 'heading')
evolv.mutate('heading').html('Test');

Documentation

Mutate Documentation

Keywords

evolv

FAQs

Package last updated on 08 Jul 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.