font-family-papandreou
Advanced tools
Comparing version 0.2.0-patch1 to 0.2.0-patch2
15
index.js
@@ -13,2 +13,3 @@ // parse | ||
var SPACEAFTERIDENTIFIER = 5; | ||
var ESCAPINGIDENTIFIER = 6; | ||
@@ -131,6 +132,18 @@ // patterns | ||
state = SPACEAFTERIDENTIFIER; | ||
} else if (c === "\\") { | ||
state = ESCAPINGIDENTIFIER; | ||
} else { | ||
} | ||
} else if (state === ESCAPINGIDENTIFIER) { | ||
if (/[0-9a-f]/i.test(c)) { | ||
// TODO: Support escaped unicode characters (backslash followed by hex digits) | ||
// https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident | ||
throw new Error('Parse error'); | ||
} else { | ||
buffer += c; | ||
state = IDENTIFIER; | ||
} | ||
@@ -137,0 +150,0 @@ } else if (state === SPACEAFTERIDENTIFIER) { |
{ | ||
"name": "font-family-papandreou", | ||
"version": "0.2.0-patch1", | ||
"version": "0.2.0-patch2", | ||
"description": "CSS font-family parser/stringifier", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
14
test.js
@@ -34,2 +34,16 @@ var expect = require('chai').expect; | ||
}); | ||
it('should parse a family name with an escaped space', function() { | ||
var result = parse('Font Awesome\\ 5 Free'); | ||
expect(result).to.have.length(1); | ||
expect(result[0]).to.equal('Font Awesome 5 Free'); | ||
}); | ||
it('should parse a family name with an escaped backslash', function() { | ||
var result = parse('Foo\\\\Bar'); | ||
expect(result).to.have.length(1); | ||
expect(result[0]).to.equal('Foo\\Bar'); | ||
}); | ||
}); | ||
@@ -36,0 +50,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8535
210