hastscript
Advanced tools
Comparing version 5.0.1 to 5.1.0
@@ -11,3 +11,7 @@ 'use strict' | ||
function factory(schema, defaultTagName) { | ||
var own = {}.hasOwnProperty | ||
function factory(schema, defaultTagName, caseSensitive) { | ||
var adjust = caseSensitive ? createAdjustMap(caseSensitive) : null | ||
return h | ||
@@ -19,4 +23,7 @@ | ||
var children = Array.prototype.slice.call(arguments, 2) | ||
var name = node.tagName.toLowerCase() | ||
var property | ||
node.tagName = adjust && own.call(adjust, name) ? adjust[name] : name | ||
if (properties && isChildren(properties, node)) { | ||
@@ -194,1 +201,15 @@ children.unshift(properties) | ||
} | ||
function createAdjustMap(values) { | ||
var length = values.length | ||
var index = -1 | ||
var result = {} | ||
var value | ||
while (++index < length) { | ||
value = values[index] | ||
result[value.toLowerCase()] = value | ||
} | ||
return result | ||
} |
{ | ||
"name": "hastscript", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "Hyperscript compatible DSL for creating virtual hast trees", | ||
@@ -26,3 +26,4 @@ "license": "MIT", | ||
"html.js", | ||
"svg.js" | ||
"svg.js", | ||
"svg-case-sensitive-tag-names.json" | ||
], | ||
@@ -41,2 +42,3 @@ "dependencies": { | ||
"remark-preset-wooorm": "^5.0.0", | ||
"svg-tag-names": "^2.0.0", | ||
"tape": "^4.0.0", | ||
@@ -47,2 +49,3 @@ "tinyify": "^2.0.0", | ||
"scripts": { | ||
"generate": "node build", | ||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", | ||
@@ -54,3 +57,3 @@ "build-bundle": "browserify . -s hastscript > hastscript.js", | ||
"test-coverage": "nyc --reporter lcov tape test.js", | ||
"test": "npm run format && npm run build && npm run test-coverage" | ||
"test": "npm run generate && npm run format && npm run build && npm run test-coverage" | ||
}, | ||
@@ -57,0 +60,0 @@ "nyc": { |
@@ -142,3 +142,3 @@ # hastscript | ||
DSL to create virtual [HAST][] trees for HTML or SVG. | ||
DSL to create virtual [**hast**][hast] [*trees*][tree] for HTML or SVG. | ||
@@ -145,0 +145,0 @@ ##### Parameters |
'use strict' | ||
var schema = require('property-information/svg') | ||
var caseSensitive = require('./svg-case-sensitive-tag-names.json') | ||
var factory = require('./factory') | ||
var svg = factory(schema, 'g') | ||
var svg = factory(schema, 'g', caseSensitive) | ||
svg.displayName = 'svg' | ||
module.exports = svg |
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
14436
8
221
9