Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additions #167

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions build/api/errors/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/api/errors/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/api/types/compileNewModificatorFunctionBody.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/utils/parse.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/utils/parse.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"lint:src": "npx eslint --fix ./src",
"lint:test": "npx eslint --fix ./test",
"test": "npm run build && mocha --allow-uncaught test/index.js",
"test:cov": "npm run build && nyc --reporter=lcov mocha --allow-uncaught --ui bdd --reporter spec ./test/index.js",
"test:cov": "npm run build && nyc --reporter=text-summary --reporter=lcov mocha --allow-uncaught --ui bdd --reporter spec ./test/index.js",
"test:debug": "npx tsc --pretty --sourceMap && npx mocha --allow-uncaught --reporter spec --inspect-brk test/index",
"test:jest": "npx jest",
"test:jest:cov": "npx jest --collectCoverage",
Expand Down
11 changes: 9 additions & 2 deletions src/api/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,18 @@ export class BASE_MNEMONICA_ERROR extends Error {
}

static get [ SymbolConstructorName ] () {
return `base of : ${MNEMONICA} : errors`;
return new String( `base of : ${MNEMONICA} : errors` );
}

}

Object.defineProperty( BASE_MNEMONICA_ERROR.prototype.constructor, 'name', {
get () {
return new String( 'BASE_MNEMONICA_ERROR' );
}
} );


export const constructError = ( name: string, message: string ) => {
const NamedErrorConstructor = class extends BASE_MNEMONICA_ERROR {
constructor ( addition: string, stack: string[] ) {
Expand All @@ -94,7 +101,7 @@ export const constructError = ( name: string, message: string ) => {
reNamer[ name ] = NamedErrorConstructor;
Object.defineProperty( reNamer[ name ].prototype.constructor, 'name', {
get () {
return name;
return new String( name );
}
} );
return reNamer[ name ];
Expand Down
3 changes: 2 additions & 1 deletion src/api/types/compileNewModificatorFunctionBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const compileNewModificatorFunctionBody = function ( FunctionName: string, asCla
} );
Object.defineProperty( ModificationBody, SymbolConstructorName, {
get () {
// return new String( FunctionName );
return FunctionName;
}
} );
Expand Down Expand Up @@ -134,7 +135,7 @@ const compileNewModificatorFunctionBody = function ( FunctionName: string, asCla

Object.defineProperty(${FunctionName}, SymbolConstructorName, {
get () {
return '${FunctionName}';
return new String( '${FunctionName}' );
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/descriptors/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const proto = {
};

const TypesCollection = function ( namespace: any, config: { [ index: string ]: any } ) {

// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;

Expand Down
8 changes: 4 additions & 4 deletions src/utils/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export const parse = ( self: any ): any => {

const proto = Reflect.getPrototypeOf( self ) as object;

if ( self.constructor.name !== proto.constructor.name ) {
if ( self.constructor.name.toString() !== proto.constructor.name.toString() ) {
throw new WRONG_ARGUMENTS_USED( `have to use "instance" itself: '${self.constructor.name}' vs '${proto.constructor.name}'` );
}

const protoProto: any = Reflect.getPrototypeOf( proto );
if ( protoProto && proto.constructor.name !== protoProto.constructor.name ) {
if ( protoProto && proto.constructor.name.toString() !== protoProto.constructor.name.toString() ) {
throw new WRONG_ARGUMENTS_USED( `have to use "instance" itself: '${proto.constructor.name}' vs '${protoProto.constructor.name}'` );
}

Expand All @@ -37,11 +37,11 @@ export const parse = ( self: any ): any => {

const { name } = proto.constructor;

const props:any = extract( { ...self } );
const props: any = extract( { ...self } );
// props.constructor = undefined;
delete props.constructor;

const joint:any = extract( Object.assign( {}, proto ) );
const joint: any = extract( Object.assign( {}, proto ) );
delete joint.constructor;

let parent;
Expand Down
Loading
Loading