Skip to content

Commit

Permalink
Rename jsonObjectInheritance -> jsonInheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasKunnen committed Jan 27, 2021
1 parent 89e2169 commit cfcbe91
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions spec/lazy-types/polymorphism-abstract-class.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {jsonArrayMember, jsonMember, jsonObject, jsonObjectInheritance, TypedJSON} from '../../src';
import {jsonArrayMember, jsonInheritance, jsonMember, jsonObject, TypedJSON} from '../../src';
import {isEqual} from '../utils/object-compare';

describe('lazy, polymorphic abstract classes', () => {
@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('inputType' in data) {
return SmallNode;
Expand Down
6 changes: 3 additions & 3 deletions spec/lazy-types/polymorphism-custom-names.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {jsonArrayMember, jsonMember, jsonObject, jsonObjectInheritance, TypedJSON} from '../../src';
import {jsonArrayMember, jsonInheritance, jsonMember, jsonObject, TypedJSON} from '../../src';
import {isEqual} from '../utils/object-compare';

describe('lazy, polymorphic custom names', () => {
@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('invest-amount' in data) {
return Investor;
Expand All @@ -27,7 +27,7 @@ describe('lazy, polymorphic custom names', () => {
}
}

@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('work-hours' in data) {
return PartTimeEmployee;
Expand Down
4 changes: 2 additions & 2 deletions spec/lazy-types/polymorphism-nested-arrays.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {jsonArrayMember, jsonMember, jsonObject, jsonObjectInheritance, TypedJSON} from '../../src';
import {jsonArrayMember, jsonInheritance, jsonMember, jsonObject, TypedJSON} from '../../src';
import {isEqual} from '../utils/object-compare';

describe('lazy, polymorphism in nested arrays', () => {
@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('inputType' in data) {
return SmallNode;
Expand Down
4 changes: 2 additions & 2 deletions spec/lazy-types/polymorphism.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {jsonArrayMember, jsonMember, jsonObject, jsonObjectInheritance, TypedJSON} from '../../src';
import {jsonArrayMember, jsonInheritance, jsonMember, jsonObject, TypedJSON} from '../../src';
import {isEqual} from '../utils/object-compare';

describe('lazy, polymorphism', () => {
@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('investAmount' in data) {
return Investor;
Expand Down
4 changes: 2 additions & 2 deletions spec/polymorphism-abstract-class.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {jsonArrayMember, jsonMember, jsonObject, jsonObjectInheritance, TypedJSON} from '../src';
import {jsonArrayMember, jsonInheritance, jsonMember, jsonObject, TypedJSON} from '../src';
import {isEqual} from './utils/object-compare';

describe('polymorphic abstract classes', () => {
@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('inputType' in data) {
return SmallNode;
Expand Down
6 changes: 3 additions & 3 deletions spec/polymorphism-custom-names.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {jsonArrayMember, jsonMember, jsonObject, jsonObjectInheritance, TypedJSON} from '../src';
import {jsonArrayMember, jsonInheritance, jsonMember, jsonObject, TypedJSON} from '../src';
import {isEqual} from './utils/object-compare';

describe('polymorphic custom names', () => {
@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('invest-amount' in data) {
return Investor;
Expand All @@ -27,7 +27,7 @@ describe('polymorphic custom names', () => {
}
}

@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('work-hours' in data) {
return PartTimeEmployee;
Expand Down
4 changes: 2 additions & 2 deletions spec/polymorphism-nested-arrays.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {jsonArrayMember, jsonMember, jsonObject, jsonObjectInheritance, TypedJSON} from '../src';
import {jsonArrayMember, jsonInheritance, jsonMember, jsonObject, TypedJSON} from '../src';
import {isEqual} from './utils/object-compare';

describe('polymorphism in nested arrays', () => {
@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('inputType' in data) {
return SmallNode;
Expand Down
4 changes: 2 additions & 2 deletions spec/polymorphism-root-abstract-class.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {jsonMember, jsonObject, jsonObjectInheritance, TypedJSON} from '../src';
import {jsonArrayMember, jsonInheritance, jsonMember, jsonObject, TypedJSON} from '../src';

describe('single class', () => {
@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
return Bob;
},
Expand Down
6 changes: 3 additions & 3 deletions spec/polymorphism.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {jsonArrayMember, jsonMember, jsonObject, jsonObjectInheritance, TypedJSON} from '../src';
import {jsonArrayMember, jsonInheritance, jsonMember, jsonObject, TypedJSON} from '../src';
import {isEqual} from './utils/object-compare';

describe('polymorphism', () => {
@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('investAmount' in data) {
return Investor;
Expand All @@ -29,7 +29,7 @@ describe('polymorphism', () => {
}
}

@jsonObjectInheritance({
@jsonInheritance({
resolveType: data => {
if ('workHours' in data) {
return PartTimeEmployee;
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export {
} from './json-object';
export {jsonMember, IJsonMemberOptions} from './json-member';
export {jsonArrayMember, IJsonArrayMemberOptions} from './json-array-member';
export {jsonObjectInheritance} from './json-object-inheritance';
export {jsonInheritance} from './json-inheritance';
export {jsonSetMember, IJsonSetMemberOptions} from './json-set-member';
export {jsonMapMember, IJsonMapMemberOptions} from './json-map-member';
export {toJson, IToJsonOptions} from './to-json';
Expand Down
2 changes: 1 addition & 1 deletion src/json-object-inheritance.ts → src/json-inheritance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface ObjectInheritanceOptions {
resolveType: (type: any) => Serializable<any> | undefined;
}

export function jsonObjectInheritance(options: ObjectInheritanceOptions) {
export function jsonInheritance(options: ObjectInheritanceOptions) {
return (target: Serializable<any>) => {
const objectMetadata = JsonObjectMetadata.ensurePresentInPrototype(target.prototype);

Expand Down

0 comments on commit cfcbe91

Please sign in to comment.