New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ocs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ocs

a programming paradigm combining traits of OOP and ECS

latest
npmnpm
Version
1.1.0
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

OCS

A programming paradigm combining traits of OOP and ECS.

Install via npm:

npm install ocs

Code Example

This is a showcase of some of the funcitonality of OCS.

// import ocs
var ocs = require('ocs');

// creates an Environment with the name "env"
var env = new ocs.Environment('env');

// creates a Component "position" that has the properties x and y, and adds it to the Environment "env"
var position = new ocs.Component('env', 'position', (x, y)=>{
	return {
		x: x,
		y: y
	}
});

// creates an Entity called "foo", and adds it to the Environment "env"
var foo = new ocs.Entity('env', 'foo');

// adds the "position" Component to foo, and passes 1 to x and 3 to y.
foo.addComponent('position', 1, 3);

// prints: 1
console.log(foo.x);

// removes the "position" Component from foo
foo.removeComponent('position');

// prints: undefined
console.log(foo.x);

// creates a Component "anchor" that has the properties x and y, and adds it to the Environment "env"
var anchor = new ocs.Component('env', 'anchor', (x, y)=>{
	return {
		anchor: new ocs.EEO({
			x: x,
			y: y
		}, (entity, key, val)=>{
			console.log(`The ${key} value of the anchor of ${entity.name} was changed to ${val}`);
		});
	}
});

// adds the "anchor" Component to foo.
foo.addComponent('anchor', 2, 5);

// changes the value of foo.anchor.x to 4
// logs to the console: "The x value of the anchor of foo was changed to 4"
foo.anchor.x = 4;

API

All of the documetation is on the OCS website.

Included with the Github Repo:

  • index.js: the library that is added with npm
  • scrybe.js: index.js with scrybe documentation included
  • performance.js: index.js with all of the error checking and logging removed
  • The full API documentation

FAQs

Package last updated on 29 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts