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

hyperx

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperx - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

test/concat.js

31

index.js

@@ -6,3 +6,8 @@ var VAR = 0, TEXT = 1, OPEN = 2, CLOSE = 3, ATTR = 4

module.exports = function (h) {
module.exports = function (h, opts) {
if (!opts) opts = {}
var concat = opts.concat || function (a, b) {
return String(a) + String(b)
}
return function (strings) {

@@ -46,5 +51,5 @@ var state = TEXT, reg = ''

if (parts[i][0] === ATTR_KEY) {
key += String(parts[i][1])
key = concat(key, parts[i][1])
} else if (parts[i][0] === VAR && parts[i][1] === ATTR_KEY) {
key += String(parts[i][2])
key = concat(key, parts[i][2])
} else break

@@ -55,6 +60,6 @@ }

if (!cur[1][key]) cur[1][key] = strfn(parts[i][1])
else cur[1][key] += String(parts[i][1])
else cur[1][key] = concat(cur[1][key], parts[i][1])
} else if (parts[i][0] === VAR && parts[i][1] === ATTR_VALUE) {
if (!cur[1][key]) cur[1][key] = strfn(parts[i][2])
else cur[1][key] += String(parts[i][2])
else cur[1][key] = concat(cur[1][key], parts[i][2])
} else {

@@ -77,3 +82,3 @@ i--

if (p[2] === undefined || p[2] === null) p[2] = ''
else if (!p[2]) p[2] = String(p[2])
else if (!p[2]) p[2] = concat('', p[2])
if (Array.isArray(p[2][0])) {

@@ -192,2 +197,9 @@ cur[2].push.apply(cur[2], p[2])

}
function strfn (x) {
if (typeof x === 'function') return x
else if (typeof x === 'string') return x
else if (x && typeof x === 'object') return x
else return concat('', x)
}
}

@@ -202,9 +214,2 @@

function strfn (x) {
if (typeof x === 'function') return x
else if (typeof x === 'string') return x
else if (x && typeof x === 'object') return x
else return String(x)
}
var closeRE = RegExp('^(' + [

@@ -211,0 +216,0 @@ 'area', 'base', 'basefont', 'bgsound', 'br', 'col', 'command', 'embed',

{
"name": "hyperx",
"version": "1.1.0",
"version": "1.2.0",
"description": "tagged template string virtual dom builder",

@@ -5,0 +5,0 @@ "main": "index.js",

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