Wondering what’s next for npm?Check out our public roadmap! »

    scrambling-text

    1.0.4 • Public • Published

    Scrambling Text

    scrambling text sample

    A very simple JavaScript library written in vanilla js for scrambling text.

    Demo Page

    main CI status Node.js Package status

    Table of Contents

    Installation

    This module is distributed via npm which is bundled with node

    npm i scrambling-text
    

    Examples

    Basic Example

    // load 'scrambling-text' module.
    import Scrambler from 'scrambling-text';
     
    // create an instance of Scrambler.
    const scrambler = new Scrambler();
     
    // define a handler that is called whenever text is scrambled.
    const handleScramble = (text) => {
      console.log(text);
    }
     
    // call scramble function with the text to be scrambled and handler.
    scrambler.scramble('- Friedrich Nietzsche -', handleScramble);

    React Example

    import React, { useRef, useState, useEffect } from 'react';
     
    // load 'scrambling-text' module.
    import Scrambler from 'scrambling-text';
     
    export default function ScramblingText() {
      // define the text to be scrambled as state.
      const [text, setText] = useState('- Friedrich Nietzsche -');
      // create an instance of Scrambler using useRef.
      const scramblerRef = useRef(new Scrambler());
     
      useEffect(() => {
        // call scramble function with the text to be scrambled and handler.
        scramblerRef.current.scramble(text, setText);
      }, []);
     
      return (
        <h1>
          {text}
        </h1>
      );
    }

    Demo Example

    Sample code from demo site

    LICENSE

    MIT

    Install

    npm i scrambling-text

    DownloadsWeekly Downloads

    12

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    579 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar