New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

omm

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

omm

An oject to markup mapper to keep plain html out of your JavaScript code

latest
Source
npmnpm
Version
0.9.3
Version published
Maintainers
1
Created
Source

#OMM - Object Markup Mapper# ##An object to markup mapper to keep plain html out of your JavaScript code##

Build Status Dependency Status

Version 0.9.0

Licensed under the MIT license

This class enables you to create Simple json objects and parse them to HTML Markup at runtime. The currently complete HTML tag reference including their complete attributes is build in this class. It's also possible to extend the given configuration and/or override complete tags with own templates (e.g. for custom attributes or partials).

You can use omm in browser and on server using node.js's require

var Omm = require('omm');

EXAMPLE:

1) Create a link:

new Omm({
    A : {
      ID : 'myLink',
      CLASS : 'a b c',
      HREF : '#',
      INSERT : 'My first link using this OMM engine'
   }
}).toHtml()

Produces:

<a href="#" class="a b c" id="myLink">My first link using this OMM engine</a>

Create a custom template (partial):

var oTpl = new Omm().extTpls({
                       IMGLINK : '<a href="{IMAGEURL}" class="imagelink" id="{IMGLINKID}"><img scr="{IMAGEURL}" alt="{ALTTEXT}"/></a>'
                     });

oTpl.setConfig({
  IMGLINK : {
      IMGLINKID : 'myId',
      IMAGEURL : 'url_to_my_image',
      ALTTEXT : 'an image'
  }
}).toHtml();

Also this type of writing is possible:

new Omm().extTpls({IMGLINK : '<a href="{IMAGEURL}" class="imagelink" id="{IMGLINK}"><img scr="{IMAGEURL}" alt="{ALTTEXT}"/></a>'})
         .setConfig({IMGLINK : {IMGLINKID : 'myId',IMAGEURL : 'url_to_my_image',ALTTEXT : 'an image'}})
         .toHtml();

Produces:

<a href="url_to_my_image" class="imagelink"><img scr="url_to_my_image" alt="an image"/></a>

Keywords

html

FAQs

Package last updated on 05 Apr 2014

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