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

utility

Package Overview
Dependencies
Maintainers
3
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utility - npm Package Compare versions

Comparing version 1.15.1 to 1.16.0

6

History.md
1.16.0 / 2019-03-25
==================
**features**
* [[`16104be`](http://github.com/node-modules/utility/commit/16104befbfde9c2a0bf95b88029436c4a182b1bb)] - feat: add getOwnEnumerables(obj, ignoreNull) (#47) (fengmk2 <<fengmk2@gmail.com>>)
1.15.1 / 2019-03-13

@@ -3,0 +9,0 @@ ==================

10

index.d.ts

@@ -383,5 +383,2 @@ export = utility;

/**
* Module dependencies.
*/
function has(

@@ -392,2 +389,7 @@ obj: ObjStatic,

function getOwnEnumerables(
obj: ObjStatic,
ignoreNull?: boolean,
): string[];
/**

@@ -592,2 +594,2 @@ * generate a real map object(clean object), no constructor, no __proto__

): string;
}
}

25

lib/object.js

@@ -27,6 +27,2 @@ 'use strict';

/**
* Module dependencies.
*/
exports.has = function has(obj, prop) {

@@ -37,2 +33,23 @@ return Object.prototype.hasOwnProperty.call(obj, prop);

/**
* Get all enumerable and ownership of property names
* @param {Object} obj - detect object
* @param {Boolean} [ignoreNull] - ignore null, undefined or NaN property
* @return {Array<String>} property names
*/
exports.getOwnEnumerables = function getOwnEnumerables(obj, ignoreNull) {
if (!obj || typeof obj !== 'object' || Array.isArray(obj)) {
return [];
}
return Object.keys(obj).filter(function(key) {
if (ignoreNull) {
var value = obj[key];
if (value === null || value === undefined || isNaN(value)) {
return false;
}
}
return exports.has(obj, key);
});
};
/**
* generate a real map object(clean object), no constructor, no __proto__

@@ -39,0 +56,0 @@ * @param {Object} [obj] - init object, optional

{
"name": "utility",
"version": "1.15.1",
"version": "1.16.0",
"description": "A collection of useful utilities.",

@@ -19,3 +19,4 @@ "main": "lib/utility.js",

"autod": "autod -w --prefix '^' -e benchmark",
"test-optimized": "node --allow-natives-syntax --trace_opt --trace_deopt test/optimized.js"
"test-optimized": "node --allow-natives-syntax --trace_opt --trace_deopt test/optimized.js",
"contributor": "git-contributor"
},

@@ -38,2 +39,3 @@ "dependencies": {

"contributors": "*",
"git-contributor": "^1.0.10",
"jshint": "*",

@@ -66,4 +68,4 @@ "moment": "^2.22.2",

},
"author": "fengmk2 <fengmk2@gmail.com> (http://fengmk2.com)",
"author": "fengmk2 <fengmk2@gmail.com> (https://fengmk2.com)",
"license": "MIT"
}

@@ -318,4 +318,16 @@ # utility

<!-- GITCONTRIBUTOR_START -->
## Contributors
|[<img src="https://avatars0.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars3.githubusercontent.com/u/985607?v=4" width="100px;"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src="https://avatars1.githubusercontent.com/u/1147375?v=4" width="100px;"/><br/><sub><b>alsotang</b></sub>](https://github.com/alsotang)<br/>|[<img src="https://avatars1.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars2.githubusercontent.com/u/1207064?v=4" width="100px;"/><br/><sub><b>gxcsoccer</b></sub>](https://github.com/gxcsoccer)<br/>|[<img src="https://avatars3.githubusercontent.com/u/2842176?v=4" width="100px;"/><br/><sub><b>XadillaX</b></sub>](https://github.com/XadillaX)<br/>|
| :---: | :---: | :---: | :---: | :---: | :---: |
[<img src="https://avatars1.githubusercontent.com/u/24466804?v=4" width="100px;"/><br/><sub><b>mosikoo</b></sub>](https://github.com/mosikoo)<br/>|[<img src="https://avatars2.githubusercontent.com/u/2569835?v=4" width="100px;"/><br/><sub><b>haoxins</b></sub>](https://github.com/haoxins)<br/>|[<img src="https://avatars1.githubusercontent.com/u/546535?v=4" width="100px;"/><br/><sub><b>leoner</b></sub>](https://github.com/leoner)<br/>|[<img src="https://avatars3.githubusercontent.com/u/33921398?v=4" width="100px;"/><br/><sub><b>ddzy</b></sub>](https://github.com/ddzy)<br/>
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sat Mar 23 2019 12:09:41 GMT+0800`.
<!-- GITCONTRIBUTOR_END -->
## License
[MIT](LICENSE.txt)
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