Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dreamworld/web-util

Package Overview
Dependencies
Maintainers
4
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dreamworld/web-util

Misc Web Development utility functions

  • 1.6.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
60
decreased by-28.57%
Maintainers
4
Weekly downloads
 
Created
Source

web-util

Misc Web Development utility functions

htmlTrim

  • Removes empty nodes/html from the both side of a given html template or String.
Examples
Example-1: Remove all begining empty nodes
  • Input:
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div>hello</div>
    
  • Output:
      <div>hello</div>
    
Example-2: Remove all end empty nodes
  • Input:
      <div>hello</div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    
  • Output:
      <div>hello</div>
    
Example-3: Trim start of first non empty nodes
  • Input:
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div>      hello</div>
    
  • Output:
      <div>hello</div>
    
Example-4: Trim end of last non empty nodes
  • Input:
      <div>hello     </div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    
  • Output:
      <div>hello</div>
    
Example-5: Remove all empty nodes from begining and end also start trim first non empty nodes and end trim last non empty nodes.
  • Input:
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div>   hello1     </div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div>   hello2     </div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    
  • Output:
      <div>hello1     </div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div>   hello2</div>
    
Example-6 nested div with text nodes
  • Input:
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div>  hello1  </div>
        <div></div>
        <div></div>
        <div>  hello2  </div>
        <div></div>
        <div></div>
      </div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    
  • Output:
      <div>
        <div>hello1  </div>
        <div></div>
        <div></div>
        <div>  hello2</div>
      </div>
    
Example-7 First node as text node
  • Input:
      hello1
      <div>
        <div></div>
        <div>  hello2  </div>
        <div></div>
        <div></div>
        <div>  hello3  </div>
        <div></div>
        <div></div>
      </div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    
  • Output:
      hello1
      <div>
        <div></div>
        <div>  hello2  </div>
        <div></div>
        <div></div>
        <div>  hello3</div>
      </div>
    

openVirtualKeyboard

  • Opens virtual keyboard in touch devices

replaceAll

  • There is no support of replaceAll method in old browsers, so it is its wrapper method which if browser's replaceAll method is available, it will use it, otherwise it will replace with custom logic using lodash's replace method.

Keywords

FAQs

Package last updated on 02 Jan 2023

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