[Pkg-javascript-commits] [node-is-descriptor] 01/06: New upstream version 2.0.0
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Thu Jan 11 17:05:41 UTC 2018
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master
in repository node-is-descriptor.
commit b4616a2283d285a7f8b1bd7092699786a745d37c
Author: Pirate Praveen <praveen at debian.org>
Date: Thu Jan 11 22:01:28 2018 +0530
New upstream version 2.0.0
---
.editorconfig | 18 ++-----
.eslintrc => .eslintrc.json | 12 +----
.gitignore | 31 +++++++++---
.travis.yml | 16 +++---
.verb.md | 77 ++++++++++-------------------
LICENSE | 2 +-
README.md | 118 ++++++++++++++++++++++++++++----------------
index.js | 18 ++++---
package.json | 32 ++++++++----
test.js | 16 +++---
utils.js | 24 ---------
11 files changed, 182 insertions(+), 182 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index 991900b..449f0da 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,22 +1,14 @@
-# http://editorconfig.org
+# http://editorconfig.org/
root = true
[*]
-indent_style = space
-end_of_line = lf
charset = utf-8
+end_of_line = lf
indent_size = 2
-trim_trailing_whitespace = true
+indent_style = space
insert_final_newline = true
+trim_trailing_whitespace = true
-[*.md]
-trim_trailing_whitespace = false
-insert_final_newline = false
-
-[test/**]
-trim_trailing_whitespace = false
-insert_final_newline = false
-
-[templates/**]
+[{**/{actual,fixtures,expected,templates}/**,*.md}]
trim_trailing_whitespace = false
insert_final_newline = false
diff --git a/.eslintrc b/.eslintrc.json
similarity index 92%
rename from .eslintrc
rename to .eslintrc.json
index 7b5d047..61e8895 100644
--- a/.eslintrc
+++ b/.eslintrc.json
@@ -1,9 +1,4 @@
{
- "ecmaFeatures": {
- "modules": true,
- "experimentalObjectRestSpread": true
- },
-
"env": {
"browser": false,
"es6": true,
@@ -34,6 +29,7 @@
"handle-callback-err": [2, "^(err|error)$" ],
"indent": [2, 2, { "SwitchCase": 1 }],
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
+ "keyword-spacing": [2, { "before": true, "after": true }],
"new-cap": [2, { "newIsCap": true, "capIsNew": false }],
"new-parens": 2,
"no-array-constructor": 2,
@@ -49,7 +45,6 @@
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty-character-class": 2,
- "no-empty-label": 2,
"no-eval": 2,
"no-ex-assign": 2,
"no-extend-native": 2,
@@ -71,7 +66,7 @@
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": [2, { "max": 1 }],
- "no-native-reassign": 2,
+ "no-native-reassign": 0,
"no-negated-in-lhs": 2,
"no-new": 2,
"no-new-func": 2,
@@ -108,13 +103,10 @@
"radix": 2,
"semi": [2, "always"],
"semi-spacing": [2, { "before": false, "after": true }],
- "space-after-keywords": [2, "always"],
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, "never"],
- "space-before-keywords": [2, "always"],
"space-in-parens": [2, "never"],
"space-infix-ops": 2,
- "space-return-throw-case": 2,
"space-unary-ops": [2, { "words": true, "nonwords": false }],
"spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }],
"use-isnan": 2,
diff --git a/.gitignore b/.gitignore
index 80a228c..f969a2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,30 @@
+# always ignore files
*.DS_Store
+.idea
+.vscode
*.sublime-*
-_gh_pages
-bower_components
+
+# test related, or directories generated by tests
+test/actual
+actual
+coverage
+.nyc*
+
+# npm
node_modules
npm-debug.log
-actual
-test/actual
+
+# yarn
+yarn.lock
+yarn-error.log
+
+# misc
+_gh_pages
+_draft
+_drafts
+bower_components
+vendor
temp
tmp
TODO.md
-vendor
-.idea
-benchmark
-coverage
+package-lock.json
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 6caa76a..1fd107d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,11 +1,11 @@
sudo: false
+os:
+ - linux
+ - osx
language: node_js
node_js:
- - "stable"
- - "4"
- - "0.12"
- - "0.10"
-matrix:
- fast_finish: true
- allow_failures:
- - node_js: "0.10"
+ - node
+ - '9'
+ - '8'
+ - '7'
+ - '6'
diff --git a/.verb.md b/.verb.md
index 7f78299..e59e881 100644
--- a/.verb.md
+++ b/.verb.md
@@ -1,10 +1,3 @@
-# {%= name %} {%= badge("fury") %} {%= badge("travis") %}
-
-> {%= description %}
-
-## Install
-{%= include("install-npm", {save: true}) %}
-
## Usage
```js
@@ -41,11 +34,11 @@ isDescriptor(obj, 'bar');
`false` when not an object
```js
-isDescriptor('a'))
+isDescriptor('a');
//=> false
-isDescriptor(null))
+isDescriptor(null);
//=> false
-isDescriptor([]))
+isDescriptor([]);
//=> false
```
@@ -54,33 +47,33 @@ isDescriptor([]))
`true` when the object has valid properties with valid values.
```js
-isDescriptor({value: 'foo'}))
+isDescriptor({value: 'foo'});
//=> true
-isDescriptor({value: noop}))
+isDescriptor({value: noop});
//=> true
```
`false` when the object has invalid properties
```js
-isDescriptor({value: 'foo', bar: 'baz'}))
+isDescriptor({value: 'foo', bar: 'baz'});
//=> false
-isDescriptor({value: 'foo', bar: 'baz'}))
+isDescriptor({value: 'foo', bar: 'baz'});
//=> false
-isDescriptor({value: 'foo', get: noop}))
+isDescriptor({value: 'foo', get: noop});
//=> false
-isDescriptor({get: noop, value: noop}))
+isDescriptor({get: noop, value: noop});
//=> false
```
`false` when a value is not the correct type
```js
-isDescriptor({value: 'foo', enumerable: 'foo'}))
+isDescriptor({value: 'foo', enumerable: 'foo'});
//=> false
-isDescriptor({value: 'foo', configurable: 'foo'}))
+isDescriptor({value: 'foo', configurable: 'foo'});
//=> false
-isDescriptor({value: 'foo', writable: 'foo'}))
+isDescriptor({value: 'foo', writable: 'foo'});
//=> false
```
@@ -89,65 +82,45 @@ isDescriptor({value: 'foo', writable: 'foo'}))
`true` when the object has valid properties with valid values.
```js
-isDescriptor({get: noop, set: noop}))
+isDescriptor({get: noop, set: noop});
//=> true
-isDescriptor({get: noop}))
+isDescriptor({get: noop});
//=> true
-isDescriptor({set: noop}))
+isDescriptor({set: noop});
//=> true
```
`false` when the object has invalid properties
```js
-isDescriptor({get: noop, set: noop, bar: 'baz'}))
+isDescriptor({get: noop, set: noop, bar: 'baz'});
//=> false
-isDescriptor({get: noop, writable: true}))
+isDescriptor({get: noop, writable: true});
//=> false
-isDescriptor({get: noop, value: true}))
+isDescriptor({get: noop, value: true});
//=> false
```
`false` when an accessor is not a function
```js
-isDescriptor({get: noop, set: 'baz'}))
+isDescriptor({get: noop, set: 'baz'});
//=> false
-isDescriptor({get: 'foo', set: noop}))
+isDescriptor({get: 'foo', set: noop});
//=> false
-isDescriptor({get: 'foo', bar: 'baz'}))
+isDescriptor({get: 'foo', bar: 'baz'});
//=> false
-isDescriptor({get: 'foo', set: 'baz'}))
+isDescriptor({get: 'foo', set: 'baz'});
//=> false
```
`false` when a value is not the correct type
```js
-isDescriptor({get: noop, set: noop, enumerable: 'foo'}))
+isDescriptor({get: noop, set: noop, enumerable: 'foo'});
//=> false
-isDescriptor({set: noop, configurable: 'foo'}))
+isDescriptor({set: noop, configurable: 'foo'});
//=> false
-isDescriptor({get: noop, configurable: 'foo'}))
+isDescriptor({get: noop, configurable: 'foo'});
//=> false
```
-
-## Related projects
-{%= related(verb.related.list, {remove: name}) %}
-
-## Running tests
-{%= include("tests") %}
-
-## Contributing
-{%= include("contributing") %}
-
-## Author
-{%= include("author") %}
-
-## License
-{%= copyright() %}
-{%= license %}
-
-***
-
-{%= include("footer") %}
diff --git a/LICENSE b/LICENSE
index 65f90ac..e33d14b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2015, Jon Schlinkert.
+Copyright (c) 2015-2017, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index b0b9f76..d5c1962 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,15 @@
-# is-descriptor [![NPM version](https://img.shields.io/npm/v/is-descriptor.svg)](https://www.npmjs.com/package/is-descriptor) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-descriptor.svg)](https://travis-ci.org/jonschlinkert/is-descriptor)
+# is-descriptor [![NPM version](https://img.shields.io/npm/v/is-descriptor.svg?style=flat)](https://www.npmjs.com/package/is-descriptor) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-descriptor.svg?style=flat)](https://npmjs.org/package/is-descriptor) [![NPM total downloads](https://img.shields.io/npm/dt/is-descriptor.svg?style=flat)](https://npmjs.org/package/is-descriptor) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-descriptor.svg?style=flat&label [...]
> Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.
+Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
+
## Install
Install with [npm](https://www.npmjs.com/):
```sh
-$ npm i is-descriptor --save
+$ npm install --save is-descriptor
```
## Usage
@@ -46,11 +48,11 @@ isDescriptor(obj, 'bar');
`false` when not an object
```js
-isDescriptor('a'))
+isDescriptor('a');
//=> false
-isDescriptor(null))
+isDescriptor(null);
//=> false
-isDescriptor([]))
+isDescriptor([]);
//=> false
```
@@ -59,33 +61,33 @@ isDescriptor([]))
`true` when the object has valid properties with valid values.
```js
-isDescriptor({value: 'foo'}))
+isDescriptor({value: 'foo'});
//=> true
-isDescriptor({value: noop}))
+isDescriptor({value: noop});
//=> true
```
`false` when the object has invalid properties
```js
-isDescriptor({value: 'foo', bar: 'baz'}))
+isDescriptor({value: 'foo', bar: 'baz'});
//=> false
-isDescriptor({value: 'foo', bar: 'baz'}))
+isDescriptor({value: 'foo', bar: 'baz'});
//=> false
-isDescriptor({value: 'foo', get: noop}))
+isDescriptor({value: 'foo', get: noop});
//=> false
-isDescriptor({get: noop, value: noop}))
+isDescriptor({get: noop, value: noop});
//=> false
```
`false` when a value is not the correct type
```js
-isDescriptor({value: 'foo', enumerable: 'foo'}))
+isDescriptor({value: 'foo', enumerable: 'foo'});
//=> false
-isDescriptor({value: 'foo', configurable: 'foo'}))
+isDescriptor({value: 'foo', configurable: 'foo'});
//=> false
-isDescriptor({value: 'foo', writable: 'foo'}))
+isDescriptor({value: 'foo', writable: 'foo'});
//=> false
```
@@ -94,79 +96,111 @@ isDescriptor({value: 'foo', writable: 'foo'}))
`true` when the object has valid properties with valid values.
```js
-isDescriptor({get: noop, set: noop}))
+isDescriptor({get: noop, set: noop});
//=> true
-isDescriptor({get: noop}))
+isDescriptor({get: noop});
//=> true
-isDescriptor({set: noop}))
+isDescriptor({set: noop});
//=> true
```
`false` when the object has invalid properties
```js
-isDescriptor({get: noop, set: noop, bar: 'baz'}))
+isDescriptor({get: noop, set: noop, bar: 'baz'});
//=> false
-isDescriptor({get: noop, writable: true}))
+isDescriptor({get: noop, writable: true});
//=> false
-isDescriptor({get: noop, value: true}))
+isDescriptor({get: noop, value: true});
//=> false
```
`false` when an accessor is not a function
```js
-isDescriptor({get: noop, set: 'baz'}))
+isDescriptor({get: noop, set: 'baz'});
//=> false
-isDescriptor({get: 'foo', set: noop}))
+isDescriptor({get: 'foo', set: noop});
//=> false
-isDescriptor({get: 'foo', bar: 'baz'}))
+isDescriptor({get: 'foo', bar: 'baz'});
//=> false
-isDescriptor({get: 'foo', set: 'baz'}))
+isDescriptor({get: 'foo', set: 'baz'});
//=> false
```
`false` when a value is not the correct type
```js
-isDescriptor({get: noop, set: noop, enumerable: 'foo'}))
+isDescriptor({get: noop, set: noop, enumerable: 'foo'});
//=> false
-isDescriptor({set: noop, configurable: 'foo'}))
+isDescriptor({set: noop, configurable: 'foo'});
//=> false
-isDescriptor({get: noop, configurable: 'foo'}))
+isDescriptor({get: noop, configurable: 'foo'});
//=> false
```
-## Related projects
+## About
+
+<details>
+<summary><strong>Contributing</strong></summary>
-* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor)
-* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor)
-* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject)
+Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
-## Running tests
+</details>
-Install dev dependencies:
+<details>
+<summary><strong>Running Tests</strong></summary>
+
+Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
-$ npm i -d && npm test
+$ npm install && npm test
```
-## Contributing
+</details>
+<details>
+<summary><strong>Building docs</strong></summary>
+
+_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
+
+To generate the readme, run the following command:
+
+```sh
+$ npm install -g verbose/verb#dev verb-generate-readme && verb
+```
+
+</details>
+
+### Related projects
+
+You might also be interested in these projects:
+
+* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.")
+* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor "Returns true if a value has the characteristics of a valid JavaScript data descriptor.")
+* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://github.com/jonschlinkert/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.")
+* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
+
+### Contributors
-Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-descriptor/issues/new).
+| **Commits** | **Contributor** |
+| --- | --- |
+| 27 | [jonschlinkert](https://github.com/jonschlinkert) |
+| 1 | [doowb](https://github.com/doowb) |
+| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
-## Author
+### Author
**Jon Schlinkert**
+* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)
* [github/jonschlinkert](https://github.com/jonschlinkert)
-* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
-## License
+### License
-Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)
-Released under the MIT license.
+Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
+Released under the [MIT License](LICENSE).
***
-_This file was generated by [verb](https://github.com/verbose/verb) on December 28, 2015._
\ No newline at end of file
+_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 28, 2017._
\ No newline at end of file
diff --git a/index.js b/index.js
index dae8678..51abf91 100644
--- a/index.js
+++ b/index.js
@@ -1,20 +1,22 @@
/*!
* is-descriptor <https://github.com/jonschlinkert/is-descriptor>
*
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
+ * Copyright (c) 2015-2017, Jon Schlinkert.
+ * Released under the MIT License.
*/
'use strict';
-var utils = require('./utils');
+var typeOf = require('kind-of');
+var isAccessor = require('is-accessor-descriptor');
+var isData = require('is-data-descriptor');
-module.exports = function isDescriptor(obj, key) {
- if (utils.typeOf(obj) !== 'object') {
+module.exports = function isDescriptor(obj, key, checkProto) {
+ if (typeOf(obj) !== 'object') {
return false;
}
- if ('get' in obj) {
- return utils.isAccessor(obj, key);
+ if (checkProto || (!('get' in obj) && !('set' in obj))) {
+ return isData(obj, key, checkProto);
}
- return utils.isData(obj, key);
+ return isAccessor(obj, key);
};
diff --git a/package.json b/package.json
index 3c6ed59..c9d6da5 100644
--- a/package.json
+++ b/package.json
@@ -1,33 +1,37 @@
{
"name": "is-descriptor",
"description": "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.",
- "version": "0.1.4",
+ "version": "2.0.0",
"homepage": "https://github.com/jonschlinkert/is-descriptor",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
+ "contributors": [
+ "Brian Woodward (https://twitter.com/doowb)",
+ "Jon Schlinkert (http://twitter.com/jonschlinkert)",
+ "(https://github.com/wtgtybhertgeghgtwtg)"
+ ],
"repository": "jonschlinkert/is-descriptor",
"bugs": {
"url": "https://github.com/jonschlinkert/is-descriptor/issues"
},
"license": "MIT",
"files": [
- "index.js",
- "utils.js"
+ "index.js"
],
"main": "index.js",
"engines": {
- "node": ">=0.10.0"
+ "node": ">=6"
},
"scripts": {
"test": "mocha"
},
"dependencies": {
- "is-accessor-descriptor": "^0.1.6",
- "is-data-descriptor": "^0.1.4",
- "kind-of": "^3.0.2",
- "lazy-cache": "^1.0.3"
+ "is-accessor-descriptor": "^2.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
},
"devDependencies": {
- "mocha": "*"
+ "gulp-format-md": "^1.0.0",
+ "mocha": "^3.5.3"
},
"keywords": [
"accessor",
@@ -58,6 +62,14 @@
},
"plugins": [
"gulp-format-md"
- ]
+ ],
+ "toc": false,
+ "layout": "default",
+ "tasks": [
+ "readme"
+ ],
+ "lint": {
+ "reflinks": true
+ }
}
}
diff --git a/test.js b/test.js
index d1ed857..50b5550 100644
--- a/test.js
+++ b/test.js
@@ -3,7 +3,7 @@
require('mocha');
var assert = require('assert');
var isDescriptor = require('./');
-var noop = function() {};
+function noop() {};
describe('isDescriptor', function() {
describe('value type', function() {
@@ -64,8 +64,8 @@ describe('isDescriptor', function() {
assert(!isDescriptor({get: noop, value: true}));
});
- it('should not be false when the object has unrecognize properties:', function() {
- assert(isDescriptor({get: noop, set: noop, bar: 'baz'}));
+ it('should be false when the object has unrecognize properties:', function() {
+ assert(!isDescriptor({get: noop, set: noop, bar: 'baz'}));
});
it('should be false when an accessor is not a function:', function() {
@@ -80,9 +80,13 @@ describe('isDescriptor', function() {
assert(!isDescriptor({get: 'foo'}));
});
- it('should be true when the object has valid properties:', function() {
- assert(isDescriptor({get: noop, set: noop}));
- assert(isDescriptor({get: noop}));
+ it('should be true when the object has all necessary properties', function() {
+ assert(isDescriptor({get: noop, set: noop, configurable: true, enumerable: true}));
+ });
+
+ it('should not be true when the object does not have all necessary properties', function() {
+ assert(!isDescriptor({get: noop, set: noop}));
+ assert(!isDescriptor({get: noop}));
});
it('should be false when a value is not the correct type:', function() {
diff --git a/utils.js b/utils.js
deleted file mode 100644
index c85e9b9..0000000
--- a/utils.js
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict';
-
-/**
- * Lazily required module dependencies
- */
-
-var utils = require('lazy-cache')(require);
-var fn = require;
-require = utils;
-
-/**
- * Utils
- */
-
-require('kind-of', 'typeOf');
-require('is-accessor-descriptor', 'isAccessor');
-require('is-data-descriptor', 'isData');
-require = fn;
-
-/**
- * Expose `utils`
- */
-
-module.exports = utils;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-is-descriptor.git
More information about the Pkg-javascript-commits
mailing list