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

gen-pasta

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gen-pasta - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

readme.md

19

gen-pasta.js

@@ -14,5 +14,24 @@ // gen-pasta.js

function combine (returned, added) {
Object.keys(added).forEach(function (key) {
returned[key] = added[key]
})
return returned
}
function last(item) {
var num = false
if (typeof item === 'number') return +item.toString().split('').pop()
if (typeof item === 'string') return item.split('').pop()
if (Array.isArray(item)) return item.pop()
if (typeof item === 'object') return Object.keys(item).pop()
return item
}
return { log: log
, l: log
, last:last
, arrify: arrify
, combine: combine
}

@@ -19,0 +38,0 @@

2

package.json
{ "name": "gen-pasta"
, "version": "0.0.1"
, "version": "0.0.2"
, "author": "Nick Niemeir <nick.niemeir@gmail.com> (http://nrn.io)"

@@ -4,0 +4,0 @@ , "main": "gen-pasta.js"

@@ -5,3 +5,3 @@ var p = require('../gen-pasta')()

test('General', function (t) {
t.plan(2)
t.plan(9)

@@ -16,3 +16,19 @@ t.doesNotThrow(p.log, 'Log does not throw')

)
t.equal(p.last([1, 2, 3]), 3, 'Last element')
t.equal(p.last({ c: 3, a: 1, b: 2}), 'b', 'Last key')
t.equal(p.last('asdf'), 'f', 'Last character')
t.equal(p.last(1234), 4, 'Last diget')
var obj1 = { foo: 'bar'}
var obj2 = { a: 42 }
var combined = p.combine(obj1, obj2)
t.equal(combined.a, 42, 'Combined')
t.equal(combined, obj1, 'obj2 and combined reference the same obj')
t.equal(obj2.foo, undefined, 'a stays the same')
})
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