New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bemquery-async-dom

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bemquery-async-dom - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

5

CHANGELOG.md

@@ -8,2 +8,6 @@ # bemquery-async-dom Changelog

## [0.1.6] – 2017-01-27
### Added
* Minification of ES6 code using [Babili](https://github.com/babel/babili).
## [0.1.5] – 2016-09-17

@@ -45,2 +49,3 @@ ### Added

[0.1.6]: https://github.com/BEMQuery/bemquery-async-dom/compare/v0.1.5...v0.1.6
[0.1.5]: https://github.com/BEMQuery/bemquery-async-dom/compare/v0.1.4...v0.1.5

@@ -47,0 +52,0 @@ [0.1.4]: https://github.com/BEMQuery/bemquery-async-dom/compare/v0.1.3...v0.1.4

3

dist/bemquery-async-dom.es5.js

@@ -1,2 +0,3 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("bemquery-core")):"function"==typeof define&&define.amd?define(["bemquery-core"],e):e(t.bemquery)}(this,function(t){"use strict";function e(t,e){var r=[];return[].forEach.call(e.classList,function(e){var n=t.getStateFromClass(String(e));n&&r.push(n)}),r}var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=function(){function t(){r(this,t),this.read=[],this.write=[]}return n(t,[{key:"add",value:function(t,e){if("read"!==t&&"write"!==t)throw new TypeError("Type must be either 'read' or 'write'.");if("function"!=typeof e)throw new TypeError("Task must be a function.");this[t].push(e)}},{key:"run",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?"read":arguments[0];if("read"!==e&&"write"!==e)throw new TypeError("Type must be either 'read' or 'write'.");return new Promise(function(r){requestAnimationFrame(function(){var n=[];return t[e].forEach(function(t){n.push(t())}),t[e]=[],r(n)})})}}]),t}();t.BEMQuery.prototype.read=function(){return this.batch||(this.batch=new i),this.batch.run("read")},t.BEMQuery.prototype.write=function(){return this.batch||(this.batch=new i),this.batch.run("write")},t.BEMQuery.prototype.html=function(t){var e=this;return this.batch||(this.batch=new i),"undefined"!=typeof t?(t=String(t),this.batch.add("write",function(){var r=e.elements;r.forEach(function(e){e.innerHTML=t})})):this.batch.add("read",function(){var t=e.elements,r=[];return t.forEach(function(t){r.push(t.innerHTML)}),r}),this},t.BEMQuery.prototype.getStates=function(){var t=this;this.batch||(this.batch=new i);var r=this.elements;return this.batch.add("read",function(){var n=[];return r.forEach(function(r){n.push(e(t.converter,r))}),n}),this}});
/*! bemquery-async-dom v0.1.6 | (c) 2016-2017 BEMQuery team | MIT license (see LICENSE) */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("bemquery-core")):"function"==typeof define&&define.amd?define(["bemquery-core"],e):e(t.bemquery)}(this,function(t){"use strict";function e(t,e){var r=[];return[].forEach.call(e.classList,function(e){var n=t.getStateFromClass(String(e));n&&r.push(n)}),r}var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=function(){function t(){r(this,t),this.read=[],this.write=[]}return n(t,[{key:"add",value:function(t,e){if("read"!==t&&"write"!==t)throw new TypeError("Type must be either 'read' or 'write'.");if("function"!=typeof e)throw new TypeError("Task must be a function.");this[t].push(e)}},{key:"run",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"read";if("read"!==e&&"write"!==e)throw new TypeError("Type must be either 'read' or 'write'.");return new Promise(function(r){requestAnimationFrame(function(){var n=[];return t[e].forEach(function(t){n.push(t())}),t[e]=[],r(n)})})}}]),t}();t.BEMQuery.prototype.read=function(){return this.batch||(this.batch=new i),this.batch.run("read")},t.BEMQuery.prototype.write=function(){return this.batch||(this.batch=new i),this.batch.run("write")},t.BEMQuery.prototype.html=function(t){var e=this;return this.batch||(this.batch=new i),"undefined"!=typeof t?(t=String(t),this.batch.add("write",function(){var r=e.elements;r.forEach(function(e){e.innerHTML=t})})):this.batch.add("read",function(){var t=e.elements,r=[];return t.forEach(function(t){r.push(t.innerHTML)}),r}),this},t.BEMQuery.prototype.getStates=function(){var t=this;this.batch||(this.batch=new i);var r=this.elements;return this.batch.add("read",function(){var n=[];return r.forEach(function(r){n.push(e(t.converter,r))}),n}),this}});
//# sourceMappingURL=bemquery-async-dom.es5.js.map

@@ -1,171 +0,2 @@

/*! bemquery-async-dom v0.1.5 | (c) 2016 BEMQuery team | MIT license (see LICENSE) */
import { BEMQuery } from 'bemquery-core';
/** Class storing queue of DOM operations. */
class Batch {
/**
* Constructing new batch.
*
* @class
*/
constructor() {
this.read = [];
this.write = [];
}
/**
* Add new operation to the batch.
*
* @param {String} type Type of operation. Must be either "read" or "write".
* @param {Function} fn Operation to be fired.
* @return {BEMQuery} Current BEMQuery instance.
*/
add( type, fn ) {
if ( type !== 'read' && type !== 'write' ) {
throw new TypeError( 'Type must be either \'read\' or \'write\'.' );
}
if ( typeof fn !== 'function' ) {
throw new TypeError( 'Task must be a function.' );
}
this[ type ].push( fn );
}
/**
* Run operations of given type.
*
* @param {String} type Type of operations to run. Must be either "read" or "write".
* @return {Promise} Promise that will be fulfilled after running all tasks.
*/
run( type = 'read' ) {
if ( type !== 'read' && type !== 'write' ) {
throw new TypeError( 'Type must be either \'read\' or \'write\'.' );
}
return new Promise( ( resolve ) => {
requestAnimationFrame( () => {
const results = [];
this[ type ].forEach( ( fn ) => {
results.push( fn() );
} );
this[ type ] = [];
return resolve( results );
} );
} );
}
}
/**
* Method that runs all read operations stored in batch
*
* @return {Promise} Promise returned by batch.
* @memberof BEMQuery
*/
BEMQuery.prototype.read = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
return this.batch.run( 'read' );
};
/**
* Method that runs all write operations stored in batch
*
* @return {Promise} Promise returned by batch.
* @memberof BEMQuery
*/
BEMQuery.prototype.write = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
return this.batch.run( 'write' );
};
/**
* Method for getting/setting inner HTML of all elements in collection
*
* @param {String} [newHTML] The new inner HTML value. If not specified,
* the method will work as getter.
* @return {BEMQuery} Current BEMQuery instance.
* @memberof BEMQuery
*/
BEMQuery.prototype.html = function( newHTML ) {
if ( !this.batch ) {
this.batch = new Batch();
}
if ( typeof newHTML !== 'undefined' ) {
newHTML = String( newHTML );
this.batch.add( 'write', () => {
const elements = this.elements;
elements.forEach( ( element ) => {
element.innerHTML = newHTML;
} );
} );
} else {
this.batch.add( 'read', () => {
const elements = this.elements;
const htmls = [];
elements.forEach( ( element ) => {
htmls.push( element.innerHTML );
} );
return htmls;
} );
}
return this;
};
function processClasses( converter, element ) {
const states = [];
[].forEach.call( element.classList, ( className ) => {
const state = converter.getStateFromClass( String( className ) );
if ( state ) {
states.push( state );
}
} );
return states;
}
/**
* Method for getting states from all elements in collection.
*
* @return {BEMQuery} Current BEMQuery instance.
* @memberof BEMQuery
*/
BEMQuery.prototype.getStates = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
const elements = this.elements;
this.batch.add( 'read', () => {
const result = [];
elements.forEach( ( element ) => {
result.push( processClasses( this.converter, element ) );
} );
return result;
} );
return this;
};
/** @class BEMQuery */
/*! bemquery-async-dom v0.1.6 | (c) 2016-2017 BEMQuery team | MIT license (see LICENSE) */import{BEMQuery}from'bemquery-core';class Batch{constructor(){this.read=[],this.write=[]}add(a,b){if('read'!==a&&'write'!==a)throw new TypeError('Type must be either \'read\' or \'write\'.');if('function'!=typeof b)throw new TypeError('Task must be a function.');this[a].push(b)}run(a='read'){if('read'!==a&&'write'!==a)throw new TypeError('Type must be either \'read\' or \'write\'.');return new Promise(b=>{requestAnimationFrame(()=>{const c=[];return this[a].forEach(d=>{c.push(d())}),this[a]=[],b(c)})})}}BEMQuery.prototype.read=function(){return this.batch||(this.batch=new Batch),this.batch.run('read')},BEMQuery.prototype.write=function(){return this.batch||(this.batch=new Batch),this.batch.run('write')},BEMQuery.prototype.html=function(a){return this.batch||(this.batch=new Batch),'undefined'==typeof a?this.batch.add('read',()=>{const b=this.elements,c=[];return b.forEach(d=>{c.push(d.innerHTML)}),c}):(a+='',this.batch.add('write',()=>{const b=this.elements;b.forEach(c=>{c.innerHTML=a})})),this};function processClasses(a,b){const c=[];return[].forEach.call(b.classList,d=>{const e=a.getStateFromClass(d+'');e&&c.push(e)}),c}BEMQuery.prototype.getStates=function(){this.batch||(this.batch=new Batch);const a=this.elements;return this.batch.add('read',()=>{const b=[];return a.forEach(c=>{b.push(processClasses(this.converter,c))}),b}),this};
//# sourceMappingURL=bemquery-async-dom.js.map

@@ -1,177 +0,2 @@

/*! bemquery-async-dom v0.1.5 | (c) 2016 BEMQuery team | MIT license (see LICENSE) */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('bemquery-core')) :
typeof define === 'function' && define.amd ? define(['bemquery-core'], factory) :
(factory(global.bemquery));
}(this, (function (bemqueryCore) { 'use strict';
/** Class storing queue of DOM operations. */
class Batch {
/**
* Constructing new batch.
*
* @class
*/
constructor() {
this.read = [];
this.write = [];
}
/**
* Add new operation to the batch.
*
* @param {String} type Type of operation. Must be either "read" or "write".
* @param {Function} fn Operation to be fired.
* @return {BEMQuery} Current BEMQuery instance.
*/
add( type, fn ) {
if ( type !== 'read' && type !== 'write' ) {
throw new TypeError( 'Type must be either \'read\' or \'write\'.' );
}
if ( typeof fn !== 'function' ) {
throw new TypeError( 'Task must be a function.' );
}
this[ type ].push( fn );
}
/**
* Run operations of given type.
*
* @param {String} type Type of operations to run. Must be either "read" or "write".
* @return {Promise} Promise that will be fulfilled after running all tasks.
*/
run( type = 'read' ) {
if ( type !== 'read' && type !== 'write' ) {
throw new TypeError( 'Type must be either \'read\' or \'write\'.' );
}
return new Promise( ( resolve ) => {
requestAnimationFrame( () => {
const results = [];
this[ type ].forEach( ( fn ) => {
results.push( fn() );
} );
this[ type ] = [];
return resolve( results );
} );
} );
}
}
/**
* Method that runs all read operations stored in batch
*
* @return {Promise} Promise returned by batch.
* @memberof BEMQuery
*/
bemqueryCore.BEMQuery.prototype.read = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
return this.batch.run( 'read' );
};
/**
* Method that runs all write operations stored in batch
*
* @return {Promise} Promise returned by batch.
* @memberof BEMQuery
*/
bemqueryCore.BEMQuery.prototype.write = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
return this.batch.run( 'write' );
};
/**
* Method for getting/setting inner HTML of all elements in collection
*
* @param {String} [newHTML] The new inner HTML value. If not specified,
* the method will work as getter.
* @return {BEMQuery} Current BEMQuery instance.
* @memberof BEMQuery
*/
bemqueryCore.BEMQuery.prototype.html = function( newHTML ) {
if ( !this.batch ) {
this.batch = new Batch();
}
if ( typeof newHTML !== 'undefined' ) {
newHTML = String( newHTML );
this.batch.add( 'write', () => {
const elements = this.elements;
elements.forEach( ( element ) => {
element.innerHTML = newHTML;
} );
} );
} else {
this.batch.add( 'read', () => {
const elements = this.elements;
const htmls = [];
elements.forEach( ( element ) => {
htmls.push( element.innerHTML );
} );
return htmls;
} );
}
return this;
};
function processClasses( converter, element ) {
const states = [];
[].forEach.call( element.classList, ( className ) => {
const state = converter.getStateFromClass( String( className ) );
if ( state ) {
states.push( state );
}
} );
return states;
}
/**
* Method for getting states from all elements in collection.
*
* @return {BEMQuery} Current BEMQuery instance.
* @memberof BEMQuery
*/
bemqueryCore.BEMQuery.prototype.getStates = function() {
if ( !this.batch ) {
this.batch = new Batch();
}
const elements = this.elements;
this.batch.add( 'read', () => {
const result = [];
elements.forEach( ( element ) => {
result.push( processClasses( this.converter, element ) );
} );
return result;
} );
return this;
};
/** @class BEMQuery */
})));
/*! bemquery-async-dom v0.1.6 | (c) 2016-2017 BEMQuery team | MIT license (see LICENSE) */(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?b(require('bemquery-core')):'function'==typeof define&&define.amd?define(['bemquery-core'],b):b(a.bemquery)})(this,function(a){'use strict';function b(d,e){const f=[];return[].forEach.call(e.classList,g=>{const h=d.getStateFromClass(g+'');h&&f.push(h)}),f}class c{constructor(){this.read=[],this.write=[]}add(d,e){if('read'!==d&&'write'!==d)throw new TypeError('Type must be either \'read\' or \'write\'.');if('function'!=typeof e)throw new TypeError('Task must be a function.');this[d].push(e)}run(d='read'){if('read'!==d&&'write'!==d)throw new TypeError('Type must be either \'read\' or \'write\'.');return new Promise(e=>{requestAnimationFrame(()=>{const f=[];return this[d].forEach(g=>{f.push(g())}),this[d]=[],e(f)})})}}a.BEMQuery.prototype.read=function(){return this.batch||(this.batch=new c),this.batch.run('read')},a.BEMQuery.prototype.write=function(){return this.batch||(this.batch=new c),this.batch.run('write')},a.BEMQuery.prototype.html=function(d){return this.batch||(this.batch=new c),'undefined'==typeof d?this.batch.add('read',()=>{const e=this.elements,f=[];return e.forEach(g=>{f.push(g.innerHTML)}),f}):(d+='',this.batch.add('write',()=>{const e=this.elements;e.forEach(f=>{f.innerHTML=d})})),this},a.BEMQuery.prototype.getStates=function(){this.batch||(this.batch=new c);const d=this.elements;return this.batch.add('read',()=>{const e=[];return d.forEach(f=>{e.push(b(this.converter,f))}),e}),this}});
//# sourceMappingURL=bemquery-async-dom.umd.js.map
{
"name": "bemquery-async-dom",
"version": "0.1.5",
"version": "0.1.6",
"description": "BEM asynchronous DOM module",
"main": "dist/bemquery-async-dom.umd.js",
"jsnext:main": "dist/bemquery-async-dom.js",
"module": "dist/bemquery-async-dom.js",
"scripts": {

@@ -11,2 +12,3 @@ "lint": "eslint -c config/eslint/default.json src/**/*.js tests/**/*.js",

"test": "karma start config/karma/default.js",
"coverage": "codecov",
"precommit": "npm test",

@@ -33,3 +35,6 @@ "commitmsg": "commitplease .git/COMMIT_EDITMSG",

"test",
"chore"
"build",
"ci",
"chore",
"revert"
],

@@ -65,2 +70,3 @@ "scope": "\\S+.*"

"chai": "^3.5.0",
"codecov": "^1.0.1",
"commitplease": "^2.7.2",

@@ -70,9 +76,8 @@ "cz-conventional-changelog": "^1.2.0",

"eslint": "^3.0.1",
"husky": "^0.11.7",
"husky": "^0.13.1",
"in-publish": "^2.0.0",
"is-travis": "^1.0.0",
"jsdoc": "^3.4.0",
"karma": "^1.0.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.0",

@@ -83,3 +88,3 @@ "karma-fixture": "^0.2.6",

"karma-mocha": "^1.0.1",
"karma-rollup-preprocessor": "^2.0.2",
"karma-rollup-preprocessor": "^3.0.1",
"karma-sinon-chai": "^1.2.0",

@@ -89,8 +94,10 @@ "lolex": "^1.4.0",

"ncp": "^2.0.0",
"rollup": "^0.35.10",
"rollup": "^0.41.1",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-commonjs": "^5.0.0",
"rollup-plugin-commonjs": "^7.0.0",
"rollup-plugin-istanbul": "^1.1.0",
"rollup-plugin-mockr": "^1.0.1",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.0",
"rollup-plugin-babili": "^1.0.3",
"rollup-plugin-uglify": "^1.0.1",
"sinon": "^1.17.4",

@@ -97,0 +104,0 @@ "sinon-chai": "^2.8.0",

# bemquery-async-dom
[![Build Status](https://travis-ci.org/BEMQuery/bemquery-async-dom.svg?branch=master)](https://travis-ci.org/BEMQuery/bemquery-async-dom) · [![Dependency Status](https://david-dm.org/BEMQuery/bemquery-async-dom.svg)](https://david-dm.org/BEMQuery/bemquery-async-dom) · [![devDependency Status](https://david-dm.org/BEMQuery/bemquery-async-dom/dev-status.svg)](https://david-dm.org/BEMQuery/bemquery-async-dom#info=devDependencies) · [![Known Vulnerabilities](https://snyk.io/test/github/bemquery/bemquery-async-dom/badge.svg)](https://snyk.io/test/github/bemquery/bemquery-async-dom) ·[![Package quality](http://packagequality.com/badge/bemquery-async-dom.png)](http://packagequality.com/#?package=bemquery-async-dom) · [![npm version](https://badge.fury.io/js/bemquery-async-dom.svg)](https://badge.fury.io/js/bemquery-async-dom) · [![Bower version](https://badge.fury.io/bo/bemquery-async-dom.svg)](https://badge.fury.io/bo/bemquery-async-dom)
[![Build Status](https://travis-ci.org/BEMQuery/bemquery-async-dom.svg?branch=master)](https://travis-ci.org/BEMQuery/bemquery-async-dom) · [![Dependency Status](https://david-dm.org/BEMQuery/bemquery-async-dom.svg)](https://david-dm.org/BEMQuery/bemquery-async-dom) · [![devDependency Status](https://david-dm.org/BEMQuery/bemquery-async-dom/dev-status.svg)](https://david-dm.org/BEMQuery/bemquery-async-dom#?type=dev) · [![Known Vulnerabilities](https://snyk.io/test/github/bemquery/bemquery-async-dom/badge.svg)](https://snyk.io/test/github/bemquery/bemquery-async-dom) ·[![Package quality](http://packagequality.com/badge/bemquery-async-dom.png)](http://packagequality.com/#?package=bemquery-async-dom) · [![npm version](https://badge.fury.io/js/bemquery-async-dom.svg)](https://badge.fury.io/js/bemquery-async-dom) · [![Bower version](https://badge.fury.io/bo/bemquery-async-dom.svg)](https://badge.fury.io/bo/bemquery-async-dom) · [![codecov](https://codecov.io/gh/BEMQuery/bemquery-async-dom/branch/master/graph/badge.svg)](https://codecov.io/gh/BEMQuery/bemquery-async-dom)

@@ -11,2 +11,3 @@ Experiment with implementing asynchronous DOM.

You can install this package from npm:
```bash

@@ -13,0 +14,0 @@ npm install bemquery-async-dom [--save]

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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