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

goodies

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

goodies - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

34

index.js
var extend = function(object, methodName, method) {
Object.defineProperty(object.prototype, methodName, {
enumerable: false,
value: method
});
if (!object.prototype[methodName]) {
Object.defineProperty(object.prototype, methodName, {
enumerable: false,
value: method
});
}
};
extend(Array, "bsearch", function(v) {
var arr = this
, hi = arr.length - 1
, lo = 0
, pos;
while (lo <= hi) {
pos = (hi - lo)/2 + lo;
pos = parseInt(pos);
if (arr[pos] > v) {
hi = pos - 1;
} else if (arr[pos] < v) {
lo = pos + 1;
} else {
return pos;
}
}
return -1;
});
extend(Array, "unique", function() {

@@ -18,2 +40,6 @@ for (var i = 1; i < this.length; ++i) {

extend(Array, "last", function() {
return this[this.length - 1];
});
extend(Object, "join", function(object) {

@@ -20,0 +46,0 @@ var objectA = object

2

package.json

@@ -5,3 +5,3 @@ {

"author": "Adam Blackburn <adam@ifit.com>",
"version": "0.1.0",
"version": "0.1.1",
"main": "index.js",

@@ -8,0 +8,0 @@ "keywords": ["goodies", "merge", "unique", "unixtime"],

@@ -21,2 +21,8 @@ # Goodies

### `Array.bsearch(value)`
This method only works on sorted arrays.
It performs binary search on the array and searches for
`value` and returns the index of value if found, or -1 if not found.
### `Date.unixTime()`

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