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

ninjson

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ninjson

Jquery JSON to HTML parser

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

A lightweight javascript front-end template engine, providing compact JSON syntax for dynamic inline HTML generation. It works as jquery plugin and requires underscore.js to run.

Examples

Div with class

$.nj(".package")
//<div class="package"></div>

Nested divs

$.nj({
  ".package": {
    ".name": "ninjson",
    ".version": "1.0.0"
  }
})
/*
<div class="package">
  <div class="name">ninjson</div>
  <div class="version">1.0.0</div>
</div>
*/

Attributes and text

$.nj({
  ".package": {
    ".name": "ninjson",
    ".version": "1.0.0",
    ".homepage": {
      "a[href='https://github.com/afanasy/ninjson']": "Fork me on Github"
    }
  }
})
/*
<div class="package">
  <div class="name">ninjson</div>
  <div class="version">1.0.0</div>
  <div class="homepage">
    <a href="https://github.com/afanasy/ninjson">Fork me on Github</a>
  </div>
</div>
*/

Jquery calls (attr, css and text)

$.nj({
  ".package": {
    ".name": "ninjson",
    ".version": "1.0.0",
    ".homepage": {
      "a.": {"attr": {"href": "https://github.com/afanasy/ninjson", "title": "Homepage"}, "css": {"text-decoration": "none"}, "text": "Fork me on Github"}
    }
  }
})
/*
<div class="package">
  <div class="name">ninjson</div>
  <div class="version">1.0.0</div>
  <div class="homepage">
    <a href="https://github.com/afanasy/ninjson">Fork me on Github</a>
  </div>
</div>
*/

Adding click event handler

$.nj({
  ".package": {
    ".name": "ninjson",
    ".version": "1.0.0",
    ".homepage": {
      "a[href=#]": {"text": "Fork me on Github", "click": function () {
         location = 'https://github.com/afanasy/ninjson'
         return false
      }}
    }
  }
})

FAQs

Package last updated on 14 Nov 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