@@ -474,7 +474,7 @@ export class CredentialSchema extends Versioned {
474474 CredentialSchema . validate ( schema ) ;
475475
476476 super ( CredentialSchema . VERSION ) ;
477- this . schema = schema as ISchema ;
477+ this . schema = schema ;
478478 // This is the schema in JSON-schema format. Kept to output in credentials or in `toJSON` without converting back from
479479 // internal representation; trading off memory for CPU time.
480480 this . jsonSchema = jsonSchema ;
@@ -835,7 +835,7 @@ export class CredentialSchema extends Versioned {
835835 terms . add ( SCHEMA_STR ) ;
836836 terms . add ( CRYPTO_VERSION_STR ) ;
837837
838- let ctx = {
838+ const ctx = {
839839 dk : 'https://ld.dock.io/credentials#'
840840 } ;
841841
@@ -890,7 +890,7 @@ export class CredentialSchema extends Versioned {
890890 ) : object {
891891 // util function needed only in this func
892892 const createFullName = ( old : string , neww : string ) : string => {
893- return old . length == 0 ? neww : `${ old } .${ neww } ` ;
893+ return old . length === 0 ? neww : `${ old } .${ neww } ` ;
894894 } ;
895895
896896 // Will either have a "type" property or will be defined using "$ref"
@@ -1081,14 +1081,14 @@ export class CredentialSchema extends Versioned {
10811081 } else if ( 'type' in schemaProps [ key ] ) {
10821082 // key in schema
10831083 if (
1084- schemaProps [ key ] [ 'type' ] == 'string' ||
1085- schemaProps [ key ] [ 'type' ] == 'integer' ||
1086- schemaProps [ key ] [ 'type' ] == 'number'
1084+ schemaProps [ key ] [ 'type' ] === 'string' ||
1085+ schemaProps [ key ] [ 'type' ] === 'integer' ||
1086+ schemaProps [ key ] [ 'type' ] === 'number'
10871087 ) {
10881088 if ( schemaProps [ key ] [ 'type' ] !== typ ) {
10891089 throw new Error ( `Mismatch in credential and given schema type: ${ schemaProps [ key ] [ 'type' ] } !== ${ typ } ` ) ;
10901090 }
1091- } else if ( schemaProps [ key ] [ 'type' ] == 'array' && typ == 'array' ) {
1091+ } else if ( schemaProps [ key ] [ 'type' ] === 'array' && typ = == 'array' ) {
10921092 if ( schemaProps [ key ] [ 'items' ] . length < value . length ) {
10931093 // If cred has more items than schema, add the missing ones
10941094 value . slice ( schemaProps [ key ] [ 'items' ] . length ) . forEach ( ( v ) => {
@@ -1098,7 +1098,7 @@ export class CredentialSchema extends Versioned {
10981098 // If cred has less items than schema, delete those items
10991099 schemaProps [ key ] [ 'items' ] = schemaProps [ key ] [ 'items' ] . slice ( 0 , value . length ) ;
11001100 }
1101- } else if ( schemaProps [ key ] [ 'type' ] == 'object' && typ == 'object' ) {
1101+ } else if ( schemaProps [ key ] [ 'type' ] === 'object' && typ = == 'object' ) {
11021102 const schemaKeys = new Set ( [ ...Object . keys ( schemaProps [ key ] [ 'properties' ] ) ] ) ;
11031103 const valKeys = new Set ( [ ...Object . keys ( value ) ] ) ;
11041104 for ( const vk of valKeys ) {
0 commit comments