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

mokuji.js

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mokuji.js - npm Package Compare versions

Comparing version 1.4.2 to 2.0.0

dist/main.js

4

dist/mokuji.min.js
/*!
* mokuji.js v1.4.2
* mokuji.js v2.0.0
* https://github.com/hiro0218/mokuji.js

@@ -7,2 +7,2 @@ *

*/
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Mokuji=r():e.Mokuji=r()}("undefined"!=typeof self?self:this,function(){return function(e){function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n={};return r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},r.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=0)}([function(e,r,n){"use strict";function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.init=undefined;var o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},a=function(){function e(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}return function(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}}(),i=n(1),u=function(e){return e&&e.__esModule?e:{default:e}}(i),c={anchorType:!0,anchorLink:!1,anchorLinkSymbol:"#",anchorLinkBefore:!0,anchorLinkClassName:""},l=[];r.init=function(){function e(r,n){if(t(this,e),r){n=o(c,n);var a=this.render(r,n);return l=[],a}}return a(e,[{key:"render",value:function(e,r){var n=this.generateMokuji(e,r);return r.anchorLink&&this.renderAnchorLink(n,r),n}},{key:"generateMokuji",value:function(e,r){for(var n=this.createHeadingWalker(e),t=null,o=0,a=document.createElement("ol"),i=document.createElement("li"),c=document.createElement("a");t=n.nextNode();){var l=t.tagName.match(/\d/g).join("");if(l=Number(l),0!==o&&o<l){var f=document.createElement("ol");a.lastChild.appendChild(f),a=f}else if(0!==o&&o>l)for(var d=0;d<o-l;d++)(0,u["default"])(a,a.parentNode)&&(a=a.parentNode.parentNode);var s=this.censorshipId(t.textContent);t.id=this.setAnchor(t.id,s,r.anchorType),a.appendChild(this.buildList(t,c.cloneNode(!1),i.cloneNode(!1))),o=l}return 0===o?null:(a=this.reverseMokuji(a),this.removeDuplicateIds(a),a)}},{key:"censorshipId",value:function(e){var r=e,n=1;if(-1!==l.indexOf(r))for(;n<10;){var t=r+"_"+n;if(-1===l.indexOf(t)){r=t,l.push(r);break}n++}else l.push(r);return r}},{key:"createHeadingWalker",value:function(e){return document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,function(e){return/^H[1-6]$/.test(e.tagName)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},!1)}},{key:"setAnchor",value:function(e,r,n){var t=e||this.replaceSpace2Underscore(r);return t=t.replace(/\&+/g,""),t=t.replace(/\&amp;+/g,""),!0===n&&(t=encodeURIComponent(t),t=t.replace(/\%+/g,".")),t}},{key:"renderAnchorLink",value:function(e,r){if(e){var n=e.getElementsByTagName("a"),t=document.createElement("a");t.classList.add(r.anchorLinkClassName);for(var o=0;o<n.length;o++){var a=n[o].hash,i=document.querySelector('[id="'+a.replace("#","")+'"]');if(i){var u=t.cloneNode(!1);u.setAttribute("href",a),u.textContent=r.anchorLinkSymbol,r.anchorLinkBefore?i.insertBefore(u,i.firstChild):i.appendChild(u)}}}}},{key:"replaceSpace2Underscore",value:function(e){return String(e).replace(/\s+/g,"_")}},{key:"buildList",value:function(e,r,n){return r.href="#"+e.id,r.textContent=e.textContent,n.appendChild(r),n}},{key:"reverseMokuji",value:function(e){for(;e.parentNode;)e=e.parentNode;return e}},{key:"removeDuplicateIds",value:function(e){for(var r=e.getElementsByTagName("a"),n=0;n<r.length;n++){var t=r[n].innerText,o=r[n].hash,a=document.querySelectorAll('[id="'+t+'"]');if(1!==a.length){var i=0;Array.from||(Array.from=function(e){return Array.prototype.slice.call(e)});for(var u=Array.from(a),c=Array.isArray(u),l=0,u=c?u:u[Symbol.iterator]();;){var f;if(c){if(l>=u.length)break;f=u[l++]}else{if(l=u.next(),l.done)break;f=l.value}for(var d=f,s=d.id+"-"+i,p=Array.from(r),h=Array.isArray(p),v=0,p=h?p:p[Symbol.iterator]();;){var y;if(h){if(v>=p.length)break;y=p[v++]}else{if(v=p.next(),v.done)break;y=v.value}var m=y;if(m.hash===o){m.href="#"+s;break}}d.id=s,i++}}}}}]),e}()},function(e,r,n){"use strict";function t(e,r){for(;e;){if(e===r)return!0;e=e.parentNode}return!1}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=t}])});
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Mokuji=r():e.Mokuji=r()}(window,function(){return function(e){var r={};function n(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)n.d(t,o,function(r){return e[r]}.bind(null,o));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=0)}([function(e,r,n){e.exports=n(1)},function(e,r,n){"use strict";function t(e,r){for(;e;){if(e===r)return!0;e=e.parentNode}return!1}function o(){return(o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function a(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}n.r(r),n.d(r,"default",function(){return u});var i={anchorType:!0,anchorLink:!1,anchorLinkSymbol:"#",anchorLinkBefore:!0,anchorLinkClassName:""},c=[],u=function(){function e(r,n){if(function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),r){n=o(i,n);var t=this.render(r,n);return c=[],t}}return function(e,r,n){r&&a(e.prototype,r),n&&a(e,n)}(e,[{key:"render",value:function(e,r){var n=this.generateMokuji(e,r);return r.anchorLink&&this.renderAnchorLink(n,r),n}},{key:"generateMokuji",value:function(e,r){for(var n=this.createHeadingWalker(e),o=null,a=0,i=document.createElement("ol"),c=document.createElement("li"),u=document.createElement("a");o=n.nextNode();){var l=o.tagName.match(/\d/g).join("");if(l=Number(l),0!==a&&a<l){var f=document.createElement("ol");i.lastChild.appendChild(f),i=f}else if(0!==a&&a>l)for(var d=0;d<a-l;d++)t(i,i.parentNode)&&(i=i.parentNode.parentNode);var s=this.censorshipId(o.textContent);o.id=this.setAnchor(o.id,s,r.anchorType),i.appendChild(this.buildList(o,u.cloneNode(!1),c.cloneNode(!1))),a=l}return 0===a?null:(i=this.reverseMokuji(i),this.removeDuplicateIds(i),i)}},{key:"censorshipId",value:function(e){var r=e,n=1;if(-1!==c.indexOf(r))for(;n<10;){var t="".concat(r,"_").concat(n);if(-1===c.indexOf(t)){r=t,c.push(r);break}n++}else c.push(r);return r}},{key:"createHeadingWalker",value:function(e){return document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,function(e){return/^H[1-6]$/.test(e.tagName)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},!1)}},{key:"setAnchor",value:function(e,r,n){var t=e||this.replaceSpace2Underscore(r);return t=(t=t.replace(/\&+/g,"")).replace(/\&amp;+/g,""),!0===n&&(t=(t=encodeURIComponent(t)).replace(/\%+/g,".")),t}},{key:"renderAnchorLink",value:function(e,r){if(e){var n=e.getElementsByTagName("a"),t=document.createElement("a");t.classList.add(r.anchorLinkClassName);for(var o=0;o<n.length;o++){var a=n[o].hash,i=document.querySelector('[id="'.concat(a.replace("#",""),'"]'));if(i){var c=t.cloneNode(!1);c.setAttribute("href",a),c.textContent=r.anchorLinkSymbol,r.anchorLinkBefore?i.insertBefore(c,i.firstChild):i.appendChild(c)}}}}},{key:"replaceSpace2Underscore",value:function(e){return String(e).replace(/\s+/g,"_")}},{key:"buildList",value:function(e,r,n){return r.href="#"+e.id,r.textContent=e.textContent,n.appendChild(r),n}},{key:"reverseMokuji",value:function(e){for(;e.parentNode;)e=e.parentNode;return e}},{key:"removeDuplicateIds",value:function(e){for(var r=e.getElementsByTagName("a"),n=0;n<r.length;n++){var t=r[n].innerText,o=r[n].hash,a=document.querySelectorAll('[id="'.concat(t,'"]'));if(1!==a.length){var i=0;Array.from||(Array.from=function(e){return Array.prototype.slice.call(e)});for(var c=Array.from(a),u=0;u<c.length;u++){for(var l=c[u],f="".concat(l.id,"-").concat(i),d=Array.from(r),s=0;s<d.length;s++){var p=d[s];if(p.hash===o){p.href="#".concat(f);break}}l.id=f,i++}}}}}]),e}()}]).default});
'use strict';
/**

@@ -10,7 +9,3 @@ * hasParentNode

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = hasParentNode;
function hasParentNode(element, parent) {
export default function hasParentNode(element, parent) {
while (element) {

@@ -20,5 +15,7 @@ if (element === parent) {

}
element = element.parentNode;
}
return false;
}
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.init = undefined;
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
var _hasParentNode = require('./hasParentNode');
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var _hasParentNode2 = _interopRequireDefault(_hasParentNode);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
import hasParentNode from './hasParentNode';
var defaults = {

@@ -27,32 +19,29 @@ anchorType: true,

};
var storeIds = [];
var init = exports.init = function () {
function init(element, options) {
_classCallCheck(this, init);
var Mokuji =
/*#__PURE__*/
function () {
function Mokuji(element, options) {
_classCallCheck(this, Mokuji);
if (!element) {
return;
}
} // set options
// set options
options = _extends(defaults, options);
// mokuji start
var mokuji = this.render(element, options);
options = _extends(defaults, options); // mokuji start
// unset storeIds
var mokuji = this.render(element, options); // unset storeIds
storeIds = [];
return mokuji;
}
_createClass(init, [{
key: 'render',
_createClass(Mokuji, [{
key: "render",
value: function render(element, options) {
// generate mokuji list
var mokuji = this.generateMokuji(element, options);
var mokuji = this.generateMokuji(element, options); // setup anchor link
// setup anchor link
if (options.anchorLink) {

@@ -65,3 +54,3 @@ this.renderAnchorLink(mokuji, options);

}, {
key: 'generateMokuji',
key: "generateMokuji",
value: function generateMokuji(element, options) {

@@ -72,3 +61,2 @@ // get heading tags

var number = 0;
var ol = document.createElement('ol');

@@ -80,5 +68,5 @@ var li = document.createElement('li');

var currentNumber = node.tagName.match(/\d/g).join(''); // heading number
currentNumber = Number(currentNumber);
// check list hierarchy
currentNumber = Number(currentNumber); // check list hierarchy
if (number !== 0 && number < currentNumber) {

@@ -92,3 +80,3 @@ // number of the heading is large (small as heading)

for (var i = 0; i < number - currentNumber; i++) {
if ((0, _hasParentNode2.default)(ol, ol.parentNode)) {
if (hasParentNode(ol, ol.parentNode)) {
ol = ol.parentNode.parentNode;

@@ -99,13 +87,11 @@ }

var textContent = this.censorshipId(node.textContent);
var textContent = this.censorshipId(node.textContent); // add to wrapper
// add to wrapper
node.id = this.setAnchor(node.id, textContent, options.anchorType);
ol.appendChild(this.buildList(node, a.cloneNode(false), li.cloneNode(false)));
ol.appendChild(this.buildList(node, a.cloneNode(false), li.cloneNode(false))); // upadte current number
// upadte current number
number = currentNumber;
}
} // not have Iterator
// not have Iterator
if (number === 0) {

@@ -115,11 +101,9 @@ return null;

ol = this.reverseMokuji(ol);
ol = this.reverseMokuji(ol); // remove duplicates by adding suffix
// remove duplicates by adding suffix
this.removeDuplicateIds(ol);
return ol;
}
}, {
key: 'censorshipId',
key: "censorshipId",
value: function censorshipId(textContent) {

@@ -131,3 +115,4 @@ var id = textContent;

while (count < 10) {
var tmp_id = id + '_' + count;
var tmp_id = "".concat(id, "_").concat(count);
if (storeIds.indexOf(tmp_id) === -1) {

@@ -138,2 +123,3 @@ id = tmp_id;

}
count++;

@@ -148,16 +134,14 @@ }

}, {
key: 'createHeadingWalker',
key: "createHeadingWalker",
value: function createHeadingWalker(element) {
return document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, function (node) {
return (/^H[1-6]$/.test(node.tagName) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
);
return /^H[1-6]$/.test(node.tagName) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}, false);
}
}, {
key: 'setAnchor',
key: "setAnchor",
value: function setAnchor(id, text, type) {
// convert spaces to _
var anchor = id || this.replaceSpace2Underscore(text);
var anchor = id || this.replaceSpace2Underscore(text); // remove &
// remove &
anchor = anchor.replace(/\&+/g, '');

@@ -174,3 +158,3 @@ anchor = anchor.replace(/\&amp;+/g, '');

}, {
key: 'renderAnchorLink',
key: "renderAnchorLink",
value: function renderAnchorLink(mokuji, options) {

@@ -187,13 +171,13 @@ if (!mokuji) {

var hash = lists[i].hash;
var headings = document.querySelector('[id="' + hash.replace('#', '') + '"]');
var headings = document.querySelector("[id=\"".concat(hash.replace('#', ''), "\"]"));
if (!headings) {
continue;
}
} // create anchor
// create anchor
var anchor = a.cloneNode(false);
anchor.setAttribute('href', hash);
anchor.textContent = options.anchorLinkSymbol;
anchor.textContent = options.anchorLinkSymbol; // insert anchor into headings
// insert anchor into headings
if (options.anchorLinkBefore) {

@@ -209,3 +193,3 @@ // before

}, {
key: 'replaceSpace2Underscore',
key: "replaceSpace2Underscore",
value: function replaceSpace2Underscore(text) {

@@ -215,3 +199,3 @@ return String(text).replace(/\s+/g, '_');

}, {
key: 'buildList',
key: "buildList",
value: function buildList(node, a, li) {

@@ -221,7 +205,6 @@ a.href = '#' + node.id;

li.appendChild(a);
return li;
}
}, {
key: 'reverseMokuji',
key: "reverseMokuji",
value: function reverseMokuji(ol) {

@@ -235,3 +218,3 @@ while (ol.parentNode) {

}, {
key: 'removeDuplicateIds',
key: "removeDuplicateIds",
value: function removeDuplicateIds(mokuji) {

@@ -243,12 +226,11 @@ var lists = mokuji.getElementsByTagName('a');

var hash = lists[i].hash;
var headings = document.querySelectorAll('[id="' + id + '"]');
var headings = document.querySelectorAll("[id=\"".concat(id, "\"]"));
if (headings.length === 1) {
continue;
}
} // duplicated id
// duplicated id
var count = 0;
// Array.from polyfill
var count = 0; // Array.from polyfill
if (!Array.from) {

@@ -260,41 +242,21 @@ Array.from = function (arrayLikeObject) {

for (var _iterator = Array.from(headings), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
var _arr = Array.from(headings);
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
for (var _i = 0; _i < _arr.length; _i++) {
var heading = _arr[_i];
var heading_id = "".concat(heading.id, "-").concat(count); // search duplicate list
var heading = _ref;
var _arr2 = Array.from(lists);
var heading_id = heading.id + '-' + count;
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var list = _arr2[_i2];
// search duplicate list
for (var _iterator2 = Array.from(lists), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var list = _ref2;
if (list.hash === hash) {
// update hash
list.href = '#' + heading_id;
list.href = "#".concat(heading_id);
break;
}
}
} // update id
// update id
heading.id = heading_id;

@@ -307,3 +269,5 @@ count++;

return init;
}();
return Mokuji;
}();
export { Mokuji as default };
{
"name": "mokuji.js",
"version": "1.4.2",
"version": "2.0.0",
"description": "A table of content JavaScript Library",
"main": "lib/index.js",
"scripts": {
"build": "babel src --out-dir lib && npm run build:umd && npm run build:umd:min",
"build:umd": "webpack src/index.js dist/mokuji.js",
"build:umd:min": "cross-env NODE_ENV=production webpack src/index.js dist/mokuji.min.js",
"build": "babel src --out-dir lib && npm run build:umd",
"build:umd": "cross-env NODE_ENV=production webpack -p --progress --mode production",
"clean": "rimraf lib dist coverage",
"lint": "eslint src",
"format": "eslint --fix src",
"precommit": "lint-staged",
"test": "npm run lint"
"test": "npm run lint",
"prepublish": "npm run build"
},
"files": [
"dist/",
"lib/"
],
"lint-staged": {

@@ -41,22 +44,28 @@ "src/*.js": [

"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.2",
"babel-eslint": "^8.2.3",
"babel-loader": "^7.1.4",
"babel-plugin-transform-es2015-for-of": "^6.23.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-preset-env": "^1.6.1",
"cross-env": "^5.1.4",
"eslint": "^4.19.1",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-promise": "^3.7.0",
"husky": "^0.14.3",
"lint-staged": "^7.0.5",
"prettier": "^1.12.1",
"@babel/cli": "7.1.5",
"@babel/core": "7.1.6",
"@babel/plugin-transform-for-of": "7.0.0",
"@babel/plugin-transform-object-assign": "7.0.0",
"@babel/preset-env": "7.1.6",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.4",
"cross-env": "^5.2.0",
"eslint": "^5.9.0",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-promise": "^4.0.1",
"husky": "^1.1.4",
"lint-staged": "^8.0.5",
"prettier": "^1.15.2",
"rimraf": "^2.6.2",
"webpack": "^3.11.0"
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}

@@ -16,10 +16,10 @@ mokuji.js

```html
<script src="../dist/mokuji.js"></script>
<script>
var mokuji = new Mokuji.init(document.getElementById('target'));
```javascript
import Mokuji from 'mokuji.js';
var list = document.getElementById('list');
list.appendChild(mokuji);
</script>
let textElement = document.querySelector('.text');
let mokuji = new Mokuji(textElement);
let listElement = document.querySelector('.list');
listElement.appendChild(mokuji);
```

@@ -26,0 +26,0 @@

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