apibuilder-js
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -158,2 +158,6 @@ import { FullyQualifiedName } from '../language'; | ||
/** | ||
* This property holds the value of the enum value. | ||
*/ | ||
get value(): string; | ||
/** | ||
* A string used to identify this enumeration value. Useful for naming the | ||
@@ -160,0 +164,0 @@ * variable corresponding to this enumeration value in code generators. |
@@ -249,2 +249,12 @@ "use strict"; | ||
}); | ||
Object.defineProperty(ApiBuilderEnumValue.prototype, "value", { | ||
/** | ||
* This property holds the value of the enum value. | ||
*/ | ||
get: function () { | ||
return this.config.value || this.config.name; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ApiBuilderEnumValue.prototype, "nickname", { | ||
@@ -251,0 +261,0 @@ /** |
{ | ||
"name": "apibuilder-js", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "A reference implementation of API Builder for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -332,2 +332,9 @@ /* eslint-disable max-classes-per-file, import/no-cycle, @typescript-eslint/no-use-before-define */ | ||
/** | ||
* This property holds the value of the enum value. | ||
*/ | ||
get value(): string { | ||
return this.config.value || this.config.name; | ||
} | ||
/** | ||
* A string used to identify this enumeration value. Useful for naming the | ||
@@ -334,0 +341,0 @@ * variable corresponding to this enumeration value in code generators. |
@@ -27,2 +27,3 @@ import faker from 'faker'; | ||
attributes: defaultTo(config.attributes, []), | ||
value: config.value, | ||
}; | ||
@@ -29,0 +30,0 @@ } |
@@ -18,2 +18,14 @@ import faker from 'faker'; | ||
test('should return value when set', () => { | ||
const config = createMockEnumValue({ name: 'no_remaining_balance', value: 'NO_REMAINING_BALANCE' }); | ||
const instance = new ApiBuilderEnumValue(config); | ||
expect(instance).toHaveProperty('value', 'NO_REMAINING_BALANCE'); | ||
}); | ||
test('should return name when value is not set', () => { | ||
const config = createMockEnumValue({ name: 'no_remaining_balance' }); | ||
const instance = new ApiBuilderEnumValue(config); | ||
expect(instance).toHaveProperty('value', 'no_remaining_balance'); | ||
}); | ||
test('should have constant case nickname', () => { | ||
@@ -20,0 +32,0 @@ const config = createMockEnumValue({ name: 'no_remaining_balance' }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
310282
9815