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.1.0 to 3.1.1

75

monkberry.js
(function (document) {
/**
* Monkberry.
* @class
* @constructor
*/
function Monkberry() {

@@ -99,2 +104,9 @@ this.pool = new Pool();

/**
* Render template to view.
* @param {string} name - Template name.
* @param {Object} values - Data to update view.
* @param {boolean} noCache - Do not take views from pool.
* @return {Monkberry.View}
*/
Monkberry.prototype.render = function (name, values, noCache) {

@@ -106,2 +118,3 @@ return this._render(name, values, noCache);

* This method is used only for private rendering of views.
* @private
*/

@@ -146,2 +159,7 @@ Monkberry.prototype._render = function (name, values, noCache) {

/**
* Prerepder view for future usage.
* @param {string} name - Template name.
* @param {number} times - Times of prerender.
*/
Monkberry.prototype.prerender = function (name, times) {

@@ -153,2 +171,6 @@ while (times--) {

/**
* Mount template into monkberry.
* @param {Object} templates
*/
Monkberry.prototype.mount = function (templates) {

@@ -177,2 +199,3 @@ var _this = this;

* Main class for view.
* @class
*/

@@ -187,13 +210,11 @@ Monkberry.View = function View() {

this.onRemove = null; // Function to call on remove.
this.onUpdate = null; // Function to call on update.
}
};
/**
* Updates view. You can specify only part of data what is needs to be updated.
* @param {Object} data
*/
Monkberry.View.prototype.update = function (data) {
var _this = this;
// Prepare data.
if (_this.onUpdate) {
_this.onUpdate(data);
}
// Collect keys.

@@ -221,2 +242,5 @@ var keys = typeof data === 'object' ? Object.keys(data) : [];

/**
* @param {Element} toNode
*/
Monkberry.View.prototype.appendTo = function (toNode) {

@@ -228,2 +252,5 @@ for (var i = 0, len = this.nodes.length; i < len; i++) {

/**
* @param {Element} toNode
*/
Monkberry.View.prototype.insertBefore = function (toNode) {

@@ -240,3 +267,7 @@ for (var i = 0, len = this.nodes.length; i < len; i++) {

Monkberry.View.prototype.dom = function (toNode) {
/**
* Return rendered node, or DocumentFragment of rendered nodes if more then one root node in template.
* @returns {Element|DocumentFragment}
*/
Monkberry.View.prototype.createDocument = function () {
if (this.nodes.length == 1) {

@@ -253,2 +284,14 @@ return this.nodes[0];

/**
* @deprecated since version 3.1.0. Use createDocument() instead.
* @returns {Element|DocumentFragment}
*/
Monkberry.View.prototype.dom = function () {
return this.createDocument();
};
/**
* Remove view from DOM.
* @param {boolean} force - If true, do not put this view into pool.
*/
Monkberry.View.prototype.remove = function (force) {

@@ -281,2 +324,6 @@ force = force || false;

/**
* @param {string} id
* @returns {Element}
*/
Monkberry.View.prototype.getElementById = function (id) {

@@ -296,2 +343,6 @@ for (var i = 0; i < this.nodes.length; i++) {

/**
* @param {string} query
* @returns {Element}
*/
Monkberry.View.prototype.querySelector = function (query) {

@@ -365,6 +416,6 @@ for (var i = 0; i < this.nodes.length; i++) {

/**
* Helper function for working with foreach loops data.
* Will transform data for "key, value of array" constructions.
*/
//
// Helper function for working with foreach loops data.
// Will transform data for "key, value of array" constructions.
//

@@ -371,0 +422,0 @@ function transformArray(data, array, keys, i, options) {

2

package.json
{
"name": "monkberry",
"version": "3.1.0",
"version": "3.1.1",
"description": "JavaScript DOM Template Engine",

@@ -5,0 +5,0 @@ "bin": "bin/monkberry",

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