best-globals 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@ common global function and constants - i.e. coalesce
8
8
  [![downloads](https://img.shields.io/npm/dm/best-globals.svg)](https://npmjs.org/package/best-globals)
9
9
  [![build](https://github.com/codenautas/best-globals/actions/workflows/node.js.yml/badge.svg)](https://github.com/codenautas/best-globals/actions/workflows/node.js.yml)
10
10
  [![coverage](https://img.shields.io/coveralls/codenautas/best-globals/master.svg)](https://coveralls.io/r/codenautas/best-globals)
11
- [![dependencies](https://img.shields.io/david/codenautas/best-globals.svg)](https://david-dm.org/codenautas/best-globals)
11
+ [![outdated-deps](https://img.shields.io/github/issues-search/codenautas/best-globals?color=9cf&label=outdated-deps&query=is%3Apr%20author%3Aapp%2Fdependabot%20is%3Aopen)](https://github.com/codenautas/best-globals/pulls/app%2Fdependabot)
12
12
 
13
13
 
14
14
  language: ![English](https://raw.githubusercontent.com/codenautas/multilang/master/img/lang-en.png)
@@ -40,6 +40,9 @@ Use `coalesce.throwError(message)` for throw an Exception if all parameters are
40
40
 
41
41
  Use `coalesce.throwErrorIfUndefined(message)` for throw an Exception if all parameters are undefined.
42
42
 
43
+ `coalesce` is similar to `??`, but `coalesce` with `null` and `undefined` returns `null`,
44
+ and `??` returns the last. Also `coalesce` can be used with his auxiliar functions `throwError` and `throwErrorIfUndefined`.
45
+
43
46
 
44
47
  ```js
45
48
  var coalesce = require('best-globals').coalesce;
@@ -47,8 +50,14 @@ var coalesce = require('best-globals').coalesce;
47
50
  console.log(coalesce(1,2)); // = 1
48
51
  console.log(coalesce(null,3)); // = 3
49
52
  console.log(coalesce(null,undefined,false,4)); // = false
53
+ console.log(coalesce(null,undefined)); // = null [1]
54
+ console.log(coalesce(undefined,null)); // = null
55
+ console.log(coalesce(undefined,undefined)); // = undefined
56
+ console.log(coalesce(undefined,coalesce.throwErrorIfUndefined('name'))); // = throw an Error [1]
50
57
  ```
51
58
 
59
+ **Note** `[1]` the behavior differs from `??`
60
+
52
61
 
53
62
  ### changing(originalConfig, changes, options)
54
63
 
package/best-globals.js CHANGED
@@ -796,7 +796,7 @@ bestGlobals.forOrder.Native = function forOrderNative(a){
796
796
  bestGlobals.nullsOrder = 1; // 1=last -1=first;
797
797
 
798
798
  bestGlobals.compareForOrder = function compareForOrder(sortColumns){
799
- var thisModule = this;
799
+ var thisModule = this || bestGlobals;
800
800
  return function forOrderComparator(row1,row2){
801
801
  var column;
802
802
  var i=0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "best-globals",
3
3
  "description": "common global function and constants - i.e. coalesce",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/best-globals",
@@ -18,21 +18,21 @@
18
18
  "dependencies": {},
19
19
  "devDependencies": {
20
20
  "colors": "~1.4.0",
21
- "cookie-parser": "^1.4.5",
21
+ "cookie-parser": "^1.4.6",
22
22
  "expect.js": "~0.3.1",
23
- "express": "^4.17.1",
23
+ "express": "^4.17.2",
24
24
  "express-session": "^1.17.2",
25
- "karma": "^6.3.4",
25
+ "karma": "^6.3.9",
26
26
  "karma-chrome-launcher": "^3.1.0",
27
- "karma-coverage": "^2.0.3",
27
+ "karma-coverage": "^2.1.0",
28
28
  "karma-coverage-html-index-reporter": "^1.0.2",
29
29
  "karma-expect": "^1.1.3",
30
- "karma-firefox-launcher": "^2.1.1",
30
+ "karma-firefox-launcher": "^2.1.2",
31
31
  "karma-mocha": "^2.0.1",
32
32
  "nyc": "~15.1.0",
33
33
  "mocha": "~9.1.3",
34
- "require-bro": "^0.2.2",
35
- "sinon": "~11.1.2",
34
+ "require-bro": "^0.3.0",
35
+ "sinon": "~12.0.1",
36
36
  "audit-copy": "~0.1.0",
37
37
  "discrepances": "~0.2.6"
38
38
  },