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

@segment/loosely-validate-event

Package Overview
Dependencies
Maintainers
32
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@segment/loosely-validate-event - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

5

HISTORY.md
1.1.0 / 2017-02-02
==================
* add optional `type` argument
1.0.0 / 2017-02-02

@@ -3,0 +8,0 @@ ==================

9

index.js

@@ -11,6 +11,7 @@ var type = require('component-type')

function looselyValidateEvent (event) {
function looselyValidateEvent (event, type) {
validateGenericEvent(event)
assert(event.type, 'You must pass an event type.')
switch (event.type) {
type = type || event.type
assert(type, 'You must pass an event type.')
switch (type) {
case 'track':

@@ -27,3 +28,3 @@ return validateTrackEvent(event)

default:
assert(0, 'Invalid event type: "' + event.type + '"')
assert(0, 'Invalid event type: "' + type + '"')
}

@@ -30,0 +31,0 @@ }

{
"name": "@segment/loosely-validate-event",
"version": "1.0.0",
"version": "1.1.0",
"main": "index.js",

@@ -5,0 +5,0 @@ "scripts": {

@@ -39,2 +39,6 @@ var test = require('ava')

}, AssertionError)
t.throws(() => {
validate({ type: '' }, null)
}, AssertionError)
})

@@ -66,6 +70,5 @@

validate({
type: 'track',
event: 'Did Something',
anonymousId: 'banana'
})
}, 'track')
})

@@ -72,0 +75,0 @@

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