ibm-cloud-sdk-core 5.0.2 → 5.1.0
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/.secrets.baseline +119 -15
- package/Authentication.md +146 -21
- package/CHANGELOG.md +7 -0
- package/README.md +3 -2
- package/auth/authenticators/authenticator.d.ts +1 -0
- package/auth/authenticators/authenticator.js +1 -0
- package/auth/authenticators/container-authenticator.d.ts +6 -0
- package/auth/authenticators/container-authenticator.js +8 -0
- package/auth/authenticators/iam-assume-authenticator.d.ts +82 -0
- package/auth/authenticators/iam-assume-authenticator.js +92 -0
- package/auth/authenticators/iam-authenticator.d.ts +6 -0
- package/auth/authenticators/iam-authenticator.js +8 -0
- package/auth/authenticators/iam-request-based-authenticator-immutable.d.ts +64 -0
- package/auth/authenticators/iam-request-based-authenticator-immutable.js +74 -0
- package/auth/authenticators/iam-request-based-authenticator.d.ts +19 -47
- package/auth/authenticators/iam-request-based-authenticator.js +28 -36
- package/auth/authenticators/index.d.ts +4 -1
- package/auth/authenticators/index.js +3 -1
- package/auth/authenticators/token-request-based-authenticator-immutable.d.ts +71 -0
- package/auth/authenticators/token-request-based-authenticator-immutable.js +91 -0
- package/auth/authenticators/token-request-based-authenticator.d.ts +4 -42
- package/auth/authenticators/token-request-based-authenticator.js +5 -43
- package/auth/token-managers/container-token-manager.d.ts +6 -0
- package/auth/token-managers/container-token-manager.js +18 -50
- package/auth/token-managers/iam-assume-token-manager.d.ts +101 -0
- package/auth/token-managers/iam-assume-token-manager.js +220 -0
- package/auth/token-managers/iam-request-based-token-manager.d.ts +3 -9
- package/auth/token-managers/iam-request-based-token-manager.js +0 -8
- package/auth/token-managers/iam-token-manager.d.ts +8 -2
- package/auth/token-managers/iam-token-manager.js +10 -2
- package/auth/token-managers/index.d.ts +4 -2
- package/auth/token-managers/index.js +6 -3
- package/auth/utils/get-authenticator-from-environment.js +3 -0
- package/auth/utils/helpers.d.ts +18 -23
- package/auth/utils/helpers.js +50 -30
- package/docs/ibm-cloud-sdk-core.api.json +787 -404
- package/es/auth/authenticators/authenticator.d.ts +1 -0
- package/es/auth/authenticators/authenticator.js +1 -0
- package/es/auth/authenticators/container-authenticator.d.ts +6 -0
- package/es/auth/authenticators/container-authenticator.js +8 -0
- package/es/auth/authenticators/iam-assume-authenticator.d.ts +82 -0
- package/es/auth/authenticators/iam-assume-authenticator.js +70 -0
- package/es/auth/authenticators/iam-authenticator.d.ts +6 -0
- package/es/auth/authenticators/iam-authenticator.js +8 -0
- package/es/auth/authenticators/iam-request-based-authenticator-immutable.d.ts +64 -0
- package/es/auth/authenticators/iam-request-based-authenticator-immutable.js +51 -0
- package/es/auth/authenticators/iam-request-based-authenticator.d.ts +19 -47
- package/es/auth/authenticators/iam-request-based-authenticator.js +26 -35
- package/es/auth/authenticators/index.d.ts +4 -1
- package/es/auth/authenticators/index.js +1 -0
- package/es/auth/authenticators/token-request-based-authenticator-immutable.d.ts +71 -0
- package/es/auth/authenticators/token-request-based-authenticator-immutable.js +65 -0
- package/es/auth/authenticators/token-request-based-authenticator.d.ts +4 -42
- package/es/auth/authenticators/token-request-based-authenticator.js +3 -39
- package/es/auth/token-managers/container-token-manager.d.ts +6 -0
- package/es/auth/token-managers/container-token-manager.js +18 -24
- package/es/auth/token-managers/iam-assume-token-manager.d.ts +101 -0
- package/es/auth/token-managers/iam-assume-token-manager.js +164 -0
- package/es/auth/token-managers/iam-request-based-token-manager.d.ts +3 -9
- package/es/auth/token-managers/iam-request-based-token-manager.js +0 -8
- package/es/auth/token-managers/iam-token-manager.d.ts +8 -2
- package/es/auth/token-managers/iam-token-manager.js +10 -2
- package/es/auth/token-managers/index.d.ts +4 -2
- package/es/auth/token-managers/index.js +4 -2
- package/es/auth/utils/get-authenticator-from-environment.js +4 -1
- package/es/auth/utils/helpers.d.ts +18 -23
- package/es/auth/utils/helpers.js +35 -27
- package/etc/ibm-cloud-sdk-core.api.md +46 -28
- package/ibm-cloud-sdk-core.d.ts +264 -68
- package/package.json +2 -2
|
@@ -28,9 +28,9 @@ export interface IamRequestOptions extends JwtTokenManagerOptions {
|
|
|
28
28
|
* class be extended with specific implementations.
|
|
29
29
|
*/
|
|
30
30
|
export declare class IamRequestBasedTokenManager extends JwtTokenManager {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
protected clientId: string;
|
|
32
|
+
protected clientSecret: string;
|
|
33
|
+
protected scope: string;
|
|
34
34
|
protected refreshToken: string;
|
|
35
35
|
protected formData: any;
|
|
36
36
|
/**
|
|
@@ -70,12 +70,6 @@ export declare class IamRequestBasedTokenManager extends JwtTokenManager {
|
|
|
70
70
|
* @param clientSecret - the client secret.
|
|
71
71
|
*/
|
|
72
72
|
setClientIdAndSecret(clientId: string, clientSecret: string): void;
|
|
73
|
-
/**
|
|
74
|
-
* Returns the most recently stored refresh token.
|
|
75
|
-
*
|
|
76
|
-
* @returns the refresh token
|
|
77
|
-
*/
|
|
78
|
-
getRefreshToken(): string;
|
|
79
73
|
/**
|
|
80
74
|
* Extend this method from the parent class to extract the refresh token from
|
|
81
75
|
* the request and save it.
|
|
@@ -120,14 +120,6 @@ var IamRequestBasedTokenManager = /** @class */ (function (_super) {
|
|
|
120
120
|
logger_1.default.warn(CLIENT_ID_SECRET_WARNING);
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
/**
|
|
124
|
-
* Returns the most recently stored refresh token.
|
|
125
|
-
*
|
|
126
|
-
* @returns the refresh token
|
|
127
|
-
*/
|
|
128
|
-
IamRequestBasedTokenManager.prototype.getRefreshToken = function () {
|
|
129
|
-
return this.refreshToken;
|
|
130
|
-
};
|
|
131
123
|
/**
|
|
132
124
|
* Extend this method from the parent class to extract the refresh token from
|
|
133
125
|
* the request and save it.
|
|
@@ -19,8 +19,8 @@ interface Options extends IamRequestOptions {
|
|
|
19
19
|
apikey: string;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* The
|
|
23
|
-
* the IAM token service to obtain and store a suitable bearer token. Additionally, the
|
|
22
|
+
* The IamTokenManager takes an api key and performs the necessary interactions with
|
|
23
|
+
* the IAM token service to obtain and store a suitable bearer token. Additionally, the IamTokenManager
|
|
24
24
|
* will retrieve bearer tokens via basic auth using a supplied "clientId" and "clientSecret" pair.
|
|
25
25
|
*/
|
|
26
26
|
export declare class IamTokenManager extends IamRequestBasedTokenManager {
|
|
@@ -46,5 +46,11 @@ export declare class IamTokenManager extends IamRequestBasedTokenManager {
|
|
|
46
46
|
* @throws Error: the configuration options are not valid.
|
|
47
47
|
*/
|
|
48
48
|
constructor(options: Options);
|
|
49
|
+
/**
|
|
50
|
+
* Returns the most recently stored refresh token.
|
|
51
|
+
*
|
|
52
|
+
* @returns the refresh token
|
|
53
|
+
*/
|
|
54
|
+
getRefreshToken(): string;
|
|
49
55
|
}
|
|
50
56
|
export {};
|
|
@@ -35,8 +35,8 @@ var helpers_1 = require("../utils/helpers");
|
|
|
35
35
|
var build_user_agent_1 = require("../../lib/build-user-agent");
|
|
36
36
|
var iam_request_based_token_manager_1 = require("./iam-request-based-token-manager");
|
|
37
37
|
/**
|
|
38
|
-
* The
|
|
39
|
-
* the IAM token service to obtain and store a suitable bearer token. Additionally, the
|
|
38
|
+
* The IamTokenManager takes an api key and performs the necessary interactions with
|
|
39
|
+
* the IAM token service to obtain and store a suitable bearer token. Additionally, the IamTokenManager
|
|
40
40
|
* will retrieve bearer tokens via basic auth using a supplied "clientId" and "clientSecret" pair.
|
|
41
41
|
*/
|
|
42
42
|
var IamTokenManager = /** @class */ (function (_super) {
|
|
@@ -72,6 +72,14 @@ var IamTokenManager = /** @class */ (function (_super) {
|
|
|
72
72
|
_this.userAgent = (0, build_user_agent_1.buildUserAgent)('iam-authenticator');
|
|
73
73
|
return _this;
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns the most recently stored refresh token.
|
|
77
|
+
*
|
|
78
|
+
* @returns the refresh token
|
|
79
|
+
*/
|
|
80
|
+
IamTokenManager.prototype.getRefreshToken = function () {
|
|
81
|
+
return this.refreshToken;
|
|
82
|
+
};
|
|
75
83
|
return IamTokenManager;
|
|
76
84
|
}(iam_request_based_token_manager_1.IamRequestBasedTokenManager));
|
|
77
85
|
exports.IamTokenManager = IamTokenManager;
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* @module token-managers
|
|
18
18
|
* The ibm-cloud-sdk-core module supports the following types of token authentication:
|
|
19
|
-
*
|
|
20
|
-
* Identity and Access Management (IAM)
|
|
19
|
+
* Identity and Access Management (IAM, grant type: apikey)
|
|
20
|
+
* Identity and Access Management (IAM, grant type: assume)
|
|
21
21
|
* Cloud Pak for Data
|
|
22
22
|
* Container (IKS, etc)
|
|
23
23
|
* VPC Instance
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
*
|
|
29
29
|
* classes:
|
|
30
30
|
* IamTokenManager: Token Manager of IAM via apikey.
|
|
31
|
+
* IamAssumeTokenManager: Token Manager of IAM via apikey and trusted profile.
|
|
31
32
|
* Cp4dTokenManager: Token Manager of CloudPak for data.
|
|
32
33
|
* ContainerTokenManager: Token manager of IAM via compute resource token.
|
|
33
34
|
* VpcInstanceTokenManager: Token manager of VPC Instance Metadata Service API tokens.
|
|
@@ -42,3 +43,4 @@ export { JwtTokenManager, JwtTokenManagerOptions } from './jwt-token-manager';
|
|
|
42
43
|
export { TokenManager, TokenManagerOptions } from './token-manager';
|
|
43
44
|
export { VpcInstanceTokenManager } from './vpc-instance-token-manager';
|
|
44
45
|
export { McspTokenManager } from './mcsp-token-manager';
|
|
46
|
+
export { IamAssumeTokenManager } from './iam-assume-token-manager';
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.McspTokenManager = exports.VpcInstanceTokenManager = exports.TokenManager = exports.JwtTokenManager = exports.IamRequestBasedTokenManager = exports.ContainerTokenManager = exports.Cp4dTokenManager = exports.IamTokenManager = void 0;
|
|
18
|
+
exports.IamAssumeTokenManager = exports.McspTokenManager = exports.VpcInstanceTokenManager = exports.TokenManager = exports.JwtTokenManager = exports.IamRequestBasedTokenManager = exports.ContainerTokenManager = exports.Cp4dTokenManager = exports.IamTokenManager = void 0;
|
|
19
19
|
/**
|
|
20
20
|
* @module token-managers
|
|
21
21
|
* The ibm-cloud-sdk-core module supports the following types of token authentication:
|
|
22
|
-
*
|
|
23
|
-
* Identity and Access Management (IAM)
|
|
22
|
+
* Identity and Access Management (IAM, grant type: apikey)
|
|
23
|
+
* Identity and Access Management (IAM, grant type: assume)
|
|
24
24
|
* Cloud Pak for Data
|
|
25
25
|
* Container (IKS, etc)
|
|
26
26
|
* VPC Instance
|
|
@@ -31,6 +31,7 @@ exports.McspTokenManager = exports.VpcInstanceTokenManager = exports.TokenManage
|
|
|
31
31
|
*
|
|
32
32
|
* classes:
|
|
33
33
|
* IamTokenManager: Token Manager of IAM via apikey.
|
|
34
|
+
* IamAssumeTokenManager: Token Manager of IAM via apikey and trusted profile.
|
|
34
35
|
* Cp4dTokenManager: Token Manager of CloudPak for data.
|
|
35
36
|
* ContainerTokenManager: Token manager of IAM via compute resource token.
|
|
36
37
|
* VpcInstanceTokenManager: Token manager of VPC Instance Metadata Service API tokens.
|
|
@@ -53,3 +54,5 @@ var vpc_instance_token_manager_1 = require("./vpc-instance-token-manager");
|
|
|
53
54
|
Object.defineProperty(exports, "VpcInstanceTokenManager", { enumerable: true, get: function () { return vpc_instance_token_manager_1.VpcInstanceTokenManager; } });
|
|
54
55
|
var mcsp_token_manager_1 = require("./mcsp-token-manager");
|
|
55
56
|
Object.defineProperty(exports, "McspTokenManager", { enumerable: true, get: function () { return mcsp_token_manager_1.McspTokenManager; } });
|
|
57
|
+
var iam_assume_token_manager_1 = require("./iam-assume-token-manager");
|
|
58
|
+
Object.defineProperty(exports, "IamAssumeTokenManager", { enumerable: true, get: function () { return iam_assume_token_manager_1.IamAssumeTokenManager; } });
|
|
@@ -81,6 +81,9 @@ function getAuthenticatorFromEnvironment(serviceName) {
|
|
|
81
81
|
else if (authType === authenticators_1.Authenticator.AUTHTYPE_IAM.toLowerCase()) {
|
|
82
82
|
authenticator = new authenticators_1.IamAuthenticator(credentials);
|
|
83
83
|
}
|
|
84
|
+
else if (authType === authenticators_1.Authenticator.AUTHTYPE_IAM_ASSUME.toLowerCase()) {
|
|
85
|
+
authenticator = new authenticators_1.IamAssumeAuthenticator(credentials);
|
|
86
|
+
}
|
|
84
87
|
else if (authType === authenticators_1.Authenticator.AUTHTYPE_CONTAINER.toLowerCase()) {
|
|
85
88
|
authenticator = new authenticators_1.ContainerAuthenticator(credentials);
|
|
86
89
|
}
|
package/auth/utils/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2019,
|
|
2
|
+
* (C) Copyright IBM Corp. 2019, 2024.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -43,17 +43,6 @@ export declare function validateInput(options: any, requiredOptions: string[]):
|
|
|
43
43
|
* @returns the current time in seconds.
|
|
44
44
|
*/
|
|
45
45
|
export declare function getCurrentTime(): number;
|
|
46
|
-
/**
|
|
47
|
-
* Checks for only one of two elements being defined.
|
|
48
|
-
* Returns true if a is defined and b is undefined,
|
|
49
|
-
* or vice versa. Returns false if both are defined
|
|
50
|
-
* or both are undefined.
|
|
51
|
-
*
|
|
52
|
-
* @param a - The first object
|
|
53
|
-
* @param b - The second object
|
|
54
|
-
* @returns true if and only if exactly one of a or b is defined
|
|
55
|
-
*/
|
|
56
|
-
export declare function onlyOne(a: any, b: any): boolean;
|
|
57
46
|
/**
|
|
58
47
|
* Removes a given suffix if it exists.
|
|
59
48
|
*
|
|
@@ -64,20 +53,26 @@ export declare function onlyOne(a: any, b: any): boolean;
|
|
|
64
53
|
*/
|
|
65
54
|
export declare function removeSuffix(str: string, suffix: string): string;
|
|
66
55
|
/**
|
|
67
|
-
* Checks
|
|
56
|
+
* Checks that exactly one of the arguments provided is defined.
|
|
57
|
+
* Returns true if one argument is defined. Returns false if no
|
|
58
|
+
* argument are defined or if 2 or more are defined.
|
|
68
59
|
*
|
|
69
|
-
* @param
|
|
70
|
-
* @
|
|
71
|
-
* @returns true if a or b is defined; false if both are undefined
|
|
60
|
+
* @param args - The spread of arguments to check
|
|
61
|
+
* @returns true if and only if exactly one argument is defined
|
|
72
62
|
*/
|
|
73
|
-
export declare function
|
|
63
|
+
export declare function onlyOne(...args: any): boolean;
|
|
74
64
|
/**
|
|
75
|
-
*
|
|
65
|
+
* Checks for at least one of the given elements being defined.
|
|
76
66
|
*
|
|
77
|
-
* @param
|
|
78
|
-
* @
|
|
67
|
+
* @param args - The spread of arguments to check
|
|
68
|
+
* @returns true if one or more are defined; false if all are undefined
|
|
69
|
+
*/
|
|
70
|
+
export declare function atLeastOne(...args: any): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Verifies that no more than one of the given elements are defined.
|
|
73
|
+
* Returns true if one or none are defined, and false otherwise.
|
|
79
74
|
*
|
|
80
|
-
* @
|
|
81
|
-
|
|
75
|
+
* @param args - The spread of arguments to check
|
|
76
|
+
* @returns false if more than one elements are defined, true otherwise
|
|
82
77
|
*/
|
|
83
|
-
export declare function atMostOne(
|
|
78
|
+
export declare function atMostOne(...args: any): boolean;
|
package/auth/utils/helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2019,
|
|
3
|
+
* (C) Copyright IBM Corp. 2019, 2024.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.atMostOne = exports.atLeastOne = exports.
|
|
18
|
+
exports.atMostOne = exports.atLeastOne = exports.onlyOne = exports.removeSuffix = exports.getCurrentTime = exports.validateInput = exports.checkCredentials = exports.computeBasicAuthHeader = void 0;
|
|
19
19
|
var helper_1 = require("../../lib/helper");
|
|
20
20
|
/**
|
|
21
21
|
* Compute and return a Basic Authorization header from a username and password.
|
|
@@ -87,20 +87,6 @@ function getCurrentTime() {
|
|
|
87
87
|
return Math.floor(Date.now() / 1000);
|
|
88
88
|
}
|
|
89
89
|
exports.getCurrentTime = getCurrentTime;
|
|
90
|
-
/**
|
|
91
|
-
* Checks for only one of two elements being defined.
|
|
92
|
-
* Returns true if a is defined and b is undefined,
|
|
93
|
-
* or vice versa. Returns false if both are defined
|
|
94
|
-
* or both are undefined.
|
|
95
|
-
*
|
|
96
|
-
* @param a - The first object
|
|
97
|
-
* @param b - The second object
|
|
98
|
-
* @returns true if and only if exactly one of a or b is defined
|
|
99
|
-
*/
|
|
100
|
-
function onlyOne(a, b) {
|
|
101
|
-
return Boolean((a && !b) || (b && !a));
|
|
102
|
-
}
|
|
103
|
-
exports.onlyOne = onlyOne;
|
|
104
90
|
/**
|
|
105
91
|
* Removes a given suffix if it exists.
|
|
106
92
|
*
|
|
@@ -117,26 +103,60 @@ function removeSuffix(str, suffix) {
|
|
|
117
103
|
}
|
|
118
104
|
exports.removeSuffix = removeSuffix;
|
|
119
105
|
/**
|
|
120
|
-
* Checks
|
|
106
|
+
* Checks that exactly one of the arguments provided is defined.
|
|
107
|
+
* Returns true if one argument is defined. Returns false if no
|
|
108
|
+
* argument are defined or if 2 or more are defined.
|
|
121
109
|
*
|
|
122
|
-
* @param
|
|
123
|
-
* @
|
|
124
|
-
* @returns true if a or b is defined; false if both are undefined
|
|
110
|
+
* @param args - The spread of arguments to check
|
|
111
|
+
* @returns true if and only if exactly one argument is defined
|
|
125
112
|
*/
|
|
126
|
-
function
|
|
127
|
-
|
|
113
|
+
function onlyOne() {
|
|
114
|
+
var args = [];
|
|
115
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
116
|
+
args[_i] = arguments[_i];
|
|
117
|
+
}
|
|
118
|
+
return countDefinedArgs(args) === 1;
|
|
128
119
|
}
|
|
129
|
-
exports.
|
|
120
|
+
exports.onlyOne = onlyOne;
|
|
130
121
|
/**
|
|
131
|
-
*
|
|
122
|
+
* Checks for at least one of the given elements being defined.
|
|
132
123
|
*
|
|
133
|
-
* @param
|
|
134
|
-
* @
|
|
124
|
+
* @param args - The spread of arguments to check
|
|
125
|
+
* @returns true if one or more are defined; false if all are undefined
|
|
126
|
+
*/
|
|
127
|
+
function atLeastOne() {
|
|
128
|
+
var args = [];
|
|
129
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
130
|
+
args[_i] = arguments[_i];
|
|
131
|
+
}
|
|
132
|
+
return countDefinedArgs(args) >= 1;
|
|
133
|
+
}
|
|
134
|
+
exports.atLeastOne = atLeastOne;
|
|
135
|
+
/**
|
|
136
|
+
* Verifies that no more than one of the given elements are defined.
|
|
137
|
+
* Returns true if one or none are defined, and false otherwise.
|
|
135
138
|
*
|
|
136
|
-
* @
|
|
137
|
-
|
|
139
|
+
* @param args - The spread of arguments to check
|
|
140
|
+
* @returns false if more than one elements are defined, true otherwise
|
|
138
141
|
*/
|
|
139
|
-
function atMostOne(
|
|
140
|
-
|
|
142
|
+
function atMostOne() {
|
|
143
|
+
var args = [];
|
|
144
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
145
|
+
args[_i] = arguments[_i];
|
|
146
|
+
}
|
|
147
|
+
return countDefinedArgs(args) <= 1;
|
|
141
148
|
}
|
|
142
149
|
exports.atMostOne = atMostOne;
|
|
150
|
+
/**
|
|
151
|
+
* Takes a list of anything (intended to be the arguments passed to one of the
|
|
152
|
+
* argument checking functions above) and returns how many elements in that
|
|
153
|
+
* list are not undefined.
|
|
154
|
+
*/
|
|
155
|
+
function countDefinedArgs(args) {
|
|
156
|
+
return args.reduce(function (total, arg) {
|
|
157
|
+
if (arg) {
|
|
158
|
+
total += 1;
|
|
159
|
+
}
|
|
160
|
+
return total;
|
|
161
|
+
}, 0);
|
|
162
|
+
}
|