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

monkberry

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monkberry - npm Package Compare versions

Comparing version 3.5.0 to 3.6.0

size.sh

41

monkberry.js

@@ -184,2 +184,25 @@ (function (document) {

/**
* Create new Monkberry instance with separate pool, templates and wrappers.
* Note what filters will be same.
* @returns {Monkberry}
*/
Monkberry.prototype.createPool = function () {
var pool = new Monkberry();
pool.filters = this.filters;
return pool;
};
/**
* Get info about prerendered templates.
* @returns {Object}
*/
Monkberry.prototype.getPoolInfo = function () {
var name, info = {};
for(name in this.pool.store) {
info[name] = this.pool.store[name].length;
}
return info;
};
Monkberry.prototype.view = function () {

@@ -322,19 +345,3 @@ return new Monkberry.View;

Monkberry.View.prototype.getElementById = function (id) {
for (var i = 0; i < this.nodes.length; i++) {
var node = this.nodes[i];
do {
if (node.id == id) {
return node;
}
// Iterate over children.
node = node.firstChild || node.nextSibling || function () {
while ((node = node.parentNode) && !node.nextSibling);
return node ? node.nextSibling : null;
}();
} while (node);
}
return null;
return this.querySelector('#' + id);
};

@@ -341,0 +348,0 @@

{
"name": "monkberry",
"version": "3.5.0",
"version": "3.6.0",
"description": "JavaScript DOM Template Engine",

@@ -38,3 +38,3 @@ "bin": "bin/monkberry",

"commander": "^2.9.0",
"monkberry-parser": "^3.5.0",
"monkberry-parser": "^3.6.0",
"source-map": "^0.5.3",

@@ -41,0 +41,0 @@ "asciitree": "^1.0.2"

@@ -39,2 +39,3 @@ # Monkberry - JavaScript template engine

- [Prerender](#prerender)
- [Pool](#pool)
- [Wrappers](#wrappers)

@@ -50,2 +51,4 @@ - [Transforms](#transforms)

- [monkberry.mount(templates)](#monkberrymounttemplates)
- [monkberry.createPool()](#monkberrycreatepool)
- [monkberry.getPoolInfo()](#monkberrygetpoolinfo)
- [Monkberry.View](#monkberryview)

@@ -457,2 +460,18 @@ - [view.appendTo(toNode)](#viewappendtotonode)

### Pool
If you have big application with a lot of template within, it may be a problem what two templates have same names.
To solve this problem create a "pool of templates":
```js
var pool = monkberry.createPool();
```
This allow to have templates with same names. `createPool` method creates new Monkberry instance.
> Note what filters remain same.
### Wrappers

@@ -568,2 +587,11 @@

#### monkberry.createPool()
Return new Monkberry instance.
#### monkberry.getPoolInfo()
Gets info about prerendered templates in pool/monkberry.
### Monkberry.View

@@ -570,0 +598,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