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

option-select-action

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

option-select-action - npm Package Compare versions

Comparing version 0.3.0 to 1.0.0

2

index.js

@@ -8,3 +8,3 @@ var slice = Array.prototype.slice

opts = opts || {}
opts.keyField = opts.keyField || 'id'
opts.keyField = opts.keyField || 'value'

@@ -11,0 +11,0 @@ return {

{
"name": "option-select-action",
"description": "add an option object to a value array or call a fuction based on the object's properties",
"version": "0.3.0",
"version": "1.0.0",
"repository": {

@@ -6,0 +6,0 @@ "url": "nrw/option-select-action"

@@ -17,14 +17,14 @@ var test = require('tape')

store.select({id: 'six'})
t.same(store.value(), [{}, {id: 'six'}])
store.select({value: 'six'})
t.same(store.value(), [{}, {value: 'six'}])
t.equal(i, 0)
store.select({id: 'inc'})
store.select({value: 'inc'})
t.equal(i, 1)
t.same(store.value(), [{}, {id: 'six'}])
t.same(store.value(), [{}, {value: 'six'}])
store.select({id: 'inc'})
store.select({value: 'inc'})
t.equal(i, 2)
t.same(store.pop(), {id: 'six'})
t.same(store.pop(), {value: 'six'})
t.same(store.value(), [{}])

@@ -45,16 +45,16 @@ store.pop()

initial = [{_id: 'eight'}]
store = SelectAction(actions, initial, {keyField: '_id'})
t.same(store.value(), [{_id: 'eight'}])
initial = [{_value: 'eight'}]
store = SelectAction(actions, initial, {keyField: '_value'})
t.same(store.value(), [{_value: 'eight'}])
store.select({_id: 'one'})
t.same(store.value(), [{_id: 'eight'}, {_id: 'one'}])
store.select({_value: 'one'})
t.same(store.value(), [{_value: 'eight'}, {_value: 'one'}])
t.equal(i, 0)
store.select({_id: 'inc'})
store.select({_value: 'inc'})
t.equal(i, 1)
t.same(store.value(), [{_id: 'eight'}, {_id: 'one'}])
t.same(store.value(), [{_value: 'eight'}, {_value: 'one'}])
store.select({_id: 'dec'})
t.same(store.value(), [{_id: 'eight'}, {_id: 'one'}])
store.select({_value: 'dec'})
t.same(store.value(), [{_value: 'eight'}, {_value: 'one'}])
t.equal(i, 0)

@@ -69,3 +69,3 @@

actions = {
add: function (obj, a, b) { i += obj.id + a + b }
add: function (obj, a, b) { i += obj.value + a + b }
}

@@ -75,3 +75,3 @@

store.select({id: 'add'}, 'one', 'two')
store.select({value: 'add'}, 'one', 'two')
t.equal(i, 'addonetwo')

@@ -78,0 +78,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