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

@emmetio/abbreviation

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emmetio/abbreviation - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

25

dist/abbreviation.cjs.js

@@ -47,3 +47,3 @@ 'use strict';

valueOf() {
return this.value;
return `${this.name}="${this.value}"`;
}

@@ -100,10 +100,20 @@ }

* Array of current node attributes
* @return {Array} Array of plain attribute objects with
* `name` and `value` properties
* @return {Attribute[]} Array of attributes
*/
get attributes() {
return this._attributes.map(attrToObject);
return this._attributes;
}
/**
* A shorthand to retreive node attributes as map
* @return {Object}
*/
get attributesMap() {
return this.attributes.reduce((out, attr) => {
out[attr.name] = attr.options.boolean ? attr.name : attr.value;
return out;
}, {});
}
/**
* Check if current node is a grouping one, e.g. has no actual representation

@@ -456,9 +466,2 @@ * and is used for grouping subsequent nodes only

function attrToObject(attr) {
return {
name: attr.name,
value: attr.valueOf()
};
}
/**

@@ -465,0 +468,0 @@ * @param {String} str

@@ -45,3 +45,3 @@ /**

valueOf() {
return this.value;
return `${this.name}="${this.value}"`;
}

@@ -98,10 +98,20 @@ }

* Array of current node attributes
* @return {Array} Array of plain attribute objects with
* `name` and `value` properties
* @return {Attribute[]} Array of attributes
*/
get attributes() {
return this._attributes.map(attrToObject);
return this._attributes;
}
/**
* A shorthand to retreive node attributes as map
* @return {Object}
*/
get attributesMap() {
return this.attributes.reduce((out, attr) => {
out[attr.name] = attr.options.boolean ? attr.name : attr.value;
return out;
}, {});
}
/**
* Check if current node is a grouping one, e.g. has no actual representation

@@ -454,9 +464,2 @@ * and is used for grouping subsequent nodes only

function attrToObject(attr) {
return {
name: attr.name,
value: attr.valueOf()
};
}
/**

@@ -463,0 +466,0 @@ * @param {String} str

@@ -31,4 +31,4 @@ 'use strict';

valueOf() {
return this.value;
return `${this.name}="${this.value}"`;
}
};

@@ -36,10 +36,20 @@ 'use strict';

* Array of current node attributes
* @return {Array} Array of plain attribute objects with
* `name` and `value` properties
* @return {Attribute[]} Array of attributes
*/
get attributes() {
return this._attributes.map(attrToObject);
return this._attributes;
}
/**
* A shorthand to retreive node attributes as map
* @return {Object}
*/
get attributesMap() {
return this.attributes.reduce((out, attr) => {
out[attr.name] = attr.options.boolean ? attr.name : attr.value;
return out;
}, {});
}
/**
* Check if current node is a grouping one, e.g. has no actual representation

@@ -392,9 +402,2 @@ * and is used for grouping subsequent nodes only

function attrToObject(attr) {
return {
name: attr.name,
value: attr.valueOf()
};
}
/**

@@ -401,0 +404,0 @@ * @param {String} str

{
"name": "@emmetio/abbreviation",
"version": "0.4.4",
"version": "0.4.5",
"description": "Emmet standalone abbreviation parser",

@@ -5,0 +5,0 @@ "main": "dist/abbreviation.cjs.js",

@@ -91,3 +91,3 @@ 'use strict';

assert(!a.hasAttribute('bar'));
assert.deepEqual(a.attributes, [{name: 'foo', value: 'bar'}]);
assert.deepEqual(a.attributesMap, {foo: 'bar'});

@@ -99,10 +99,7 @@ assert.equal(a.getAttribute('foo').name, 'foo');

a.setAttribute('foo', 'baz');
assert.deepEqual(a.attributes, [{name: 'foo', value: 'baz'}]);
assert.deepEqual(a.attributesMap, {foo: 'baz'});
assert.equal(a.getAttribute('foo').value, 'baz');
a.setAttribute('a', 'b');
assert.deepEqual(a.attributes, [
{name: 'foo', value: 'baz'},
{name: 'a', value: 'b'}
]);
assert.deepEqual(a.attributesMap, {foo: 'baz', a: 'b'});

@@ -112,6 +109,3 @@ a.replaceAttribute('foo', 'foo2', 'baz2');

a.replaceAttribute('bar', 'bar2', 'baz2');
assert.deepEqual(a.attributes, [
{name: 'foo2', value: 'baz2'},
{name: 'a', value: 'b'}
]);
assert.deepEqual(a.attributesMap, {foo2: 'baz2', a: 'b'});

@@ -122,10 +116,7 @@ // remove non-existing attribute

assert.equal(a.attributes.length, 1);
assert.deepEqual(a.attributes, [{name: 'a', value: 'b'}]);
assert.deepEqual(a.attributesMap, {a: 'b'});
const b = new Node('b', [{name: 'foo', value: 'bar'}, 'a']);
assert.equal(b.attributes.length, 2);
assert.deepEqual(b.attributes, [
{name: 'foo', value: 'bar'},
{name: 'a', value: null}
]);
assert.deepEqual(b.attributesMap, {foo: 'bar', a: null});
});

@@ -138,3 +129,3 @@

a.addClass('foo');
assert.deepEqual(a.attributes, [{name: 'class', value: 'foo'}]);
assert.deepEqual(a.attributesMap, {'class': 'foo'});

@@ -146,7 +137,7 @@ a.addClass('foo');

assert(!a.hasClass('baz'));
assert.deepEqual(a.attributes, [{name: 'class', value: 'foo bar'}]);
assert.deepEqual(a.attributesMap, {'class': 'foo bar'});
a.removeClass('foo');
a.removeClass('baz');
assert.deepEqual(a.attributes, [{name: 'class', value: 'bar'}]);
assert.deepEqual(a.attributesMap, {'class': 'bar'});

@@ -164,6 +155,6 @@ const b = new Node('b', [{name: 'class', value: 'foo bar'}]);

assert.deepEqual(a.attributes, [
{name: 'class', value: 'foo bar'},
{name: 'selected', value: null}
]);
assert.deepEqual(a.attributesMap, {
'class': 'foo bar',
'selected': 'selected'
});

@@ -173,6 +164,6 @@ const b = a.clone();

assert.equal(b.name, 'a');
assert.deepEqual(b.attributes, [
{name: 'class', value: 'foo bar'},
{name: 'selected', value: null}
]);
assert.deepEqual(b.attributesMap, {
'class': 'foo bar',
'selected': 'selected'
});

@@ -186,4 +177,4 @@ assert(b.getAttribute('selected').options.boolean);

assert.equal(a.getAttribute('class').valueOf(), 'foo');
assert.equal(b.getAttribute('class').valueOf(), 'foo bar');
assert.equal(a.getAttribute('class').value, 'foo');
assert.equal(b.getAttribute('class').value, 'foo bar');

@@ -190,0 +181,0 @@ assert.equal(a.getAttribute('selected').options.boolean, false);

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