Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

evjs

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evjs - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

1

dist/individual/individual.d.ts

@@ -12,2 +12,3 @@ import { IndividualConfig } from './individual.model';

private mateFn;
readonly fullname: string;
constructor(config: IndividualConfig);

@@ -14,0 +15,0 @@ setFitness(): Promise<void>;

17

dist/individual/individual.js

@@ -17,2 +17,5 @@ "use strict";

class Individual {
get fullname() {
return `${this.name.first} ${this.name.last}`;
}
constructor(config) {

@@ -22,3 +25,4 @@ this.entity = config.entity;

first: chance.first(),
last: typeof config.name !== 'undefined' && typeof config.name.last !== 'undefined'
last: typeof config.name !== 'undefined' &&
typeof config.name.last !== 'undefined'
? config.name.last

@@ -33,3 +37,3 @@ : chance.last()

return __awaiter(this, void 0, void 0, function* () {
this.fitness = yield this.fitnessFn(this.entity);
this.fitness = yield this.fitnessFn(this.entity, this.fullname);
});

@@ -39,3 +43,3 @@ }

const entity = this.entity;
const mutated = this.mutateFn(entity);
const mutated = this.mutateFn(entity, this.fullname);
const config = this.makeConfig(mutated);

@@ -47,3 +51,3 @@ return new Individual(config);

const father = other.entity;
const kids = this.mateFn(mother, father);
const kids = this.mateFn(mother, father, this.fullname, other.fullname);
const son = this.makeConfig(kids[0]);

@@ -54,6 +58,3 @@ const daughter = this.makeConfig(kids[1]);

};
return [
new Individual(son),
new Individual(daughter)
];
return [new Individual(son), new Individual(daughter)];
}

@@ -60,0 +61,0 @@ makeConfig(entity) {

export interface Fitness {
(entity: any): number;
(entity: any, name: string): number;
}
export interface Mutate {
(entity: any): any;
(entity: any, name: string): any;
}
export interface Mate {
(mother: any, father: any): [any, any];
(mother: any, father: any, motherName: string, fatherName: string): [any, any];
}

@@ -10,0 +10,0 @@ export interface IndividualConfig {

{
"name": "evjs",
"version": "0.2.2",
"version": "0.2.3",
"description": "Generic genetic/evolution algorithm in JS",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc