Socket
Socket
Sign inDemoInstall

prototypes

Package Overview
Dependencies
0
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.1 to 0.4.2

15

lib/object.js

@@ -15,2 +15,3 @@ 'use strict';

var newObject = {};
var NewObject = {};

@@ -130,4 +131,18 @@ /**

/**
* Get all values for a parameter object in an array.
* Note: operates on the global Object, not on the prototype.
*/
NewObject.values = function(object)
{
var keys = Object.keys(object);
return keys.map(function(key)
{
return object[key];
});
};
// add new object functions as properties
core.addProperties(Object.prototype, newObject);
core.addProperties(Object, NewObject);

2

package.json
{
"name": "prototypes",
"version": "0.4.1",
"version": "0.4.2",
"description": "Some common prototypes for node.js: string.startsWith(), object.countProperties() and more. Facilities for functional programming with objects: object.forEach(), object.filter(). Functions are added safely using Object.defineProperty().",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/alexfernandez/prototypes",

@@ -257,2 +257,13 @@ [![Build Status](https://secure.travis-ci.org/alexfernandez/prototypes.png)](http://travis-ci.org/alexfernandez/prototypes)

## Object Functions
Functions added to `Object` are available to operate on parameter objects.
### Object.values(object)
Get an array with all values in the object. Example:
Object.values({first: 'a', second: 'b'});
\=> ['a', 'b']
## Array Prototypes

@@ -259,0 +270,0 @@

@@ -136,2 +136,17 @@ 'use strict';

function testValues(callback)
{
var object = {
first: 'a',
second: 'b',
1: 37,
'a-b.c': {},
};
var values = Object.values(object);
// strangely enough, Object.keys() returns property 1 first
var expected = [37, 'a', 'b', {}];
testing.assertEquals(values, expected, 'Invalid values()', callback);
testing.success(callback);
}
/**

@@ -148,2 +163,3 @@ * Run package tests.

testForEach,
testValues,
];

@@ -150,0 +166,0 @@ testing.run(tests, callback);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc