All Projects → aimingoo → metameta

aimingoo / metameta

Licence: Apache-2.0 license
Metameta is meta core and meta-class programming framework.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to metameta

vuepress-plugin-autometa
Auto meta tags plugin for VuePress 1.x
Stars: ✭ 40 (+2.56%)
Mutual labels:  meta
meta-extractor
Super simple and fast html page meta data extractor with low memory footprint
Stars: ✭ 38 (-2.56%)
Mutual labels:  meta
laravel-assets
Laravel Assets manager
Stars: ✭ 13 (-66.67%)
Mutual labels:  meta
compiler-course-unipi
Lab of the course Languages, Compilers and Interpreters (Cod. 653AA) @ UNIPI
Stars: ✭ 18 (-53.85%)
Mutual labels:  language-design
meta-learning
Meta Reinforcement Learning Experiments
Stars: ✭ 32 (-17.95%)
Mutual labels:  meta
process-handbook
📗 Contains our processes, questions and journey to creating ateam
Stars: ✭ 70 (+79.49%)
Mutual labels:  meta
Cometary
Roslyn extensions, with a touch of meta-programming.
Stars: ✭ 31 (-20.51%)
Mutual labels:  meta
audio-tag-analyzer
Extracts metadata music metadata found in audio files
Stars: ✭ 18 (-53.85%)
Mutual labels:  meta
meta-git
git plugin for meta
Stars: ✭ 22 (-43.59%)
Mutual labels:  meta
Silverstripe-SEO
A SilverStripe module to optimise the Meta, crawling, indexing, and sharing of your website content
Stars: ✭ 41 (+5.13%)
Mutual labels:  meta
Java-Programs
Java Practiced Problems including concepts of OOPS, Interface, String , Collection.
Stars: ✭ 51 (+30.77%)
Mutual labels:  oop-concepts
goopen
Go Open. A campaign to help increase awareness and remove FUD about going open
Stars: ✭ 22 (-43.59%)
Mutual labels:  meta
wp-term-meta-ui
A base UI class for a term metadata user interface
Stars: ✭ 23 (-41.03%)
Mutual labels:  meta
wp-term-images
Images for categories, tags, and other taxonomy terms
Stars: ✭ 34 (-12.82%)
Mutual labels:  meta
lip
An embeddable LISP in C99
Stars: ✭ 16 (-58.97%)
Mutual labels:  language-design
phoenix meta tags
Phoenix library helps generating meta tags for website.
Stars: ✭ 25 (-35.9%)
Mutual labels:  meta
MetaCPP
C++ Reflection & Serialization using Clang's LibTooling
Stars: ✭ 44 (+12.82%)
Mutual labels:  meta
meta-theme-sky-color
Js snippet that changes the mobile Chrome nav bar color to the color of the sky based on time of day.
Stars: ✭ 19 (-51.28%)
Mutual labels:  meta
delegated-execution-subscriptions
🕰️⚙️Recurring delegated execution through an identity proxy with meta transactions
Stars: ✭ 42 (+7.69%)
Mutual labels:  meta
oge
Page metadata as a service
Stars: ✭ 22 (-43.59%)
Mutual labels:  meta

Metameta

Metameta is meta core and meta-class programming framework.

Usage

# install from npm
> npm install @aimingoo/metameta

# OR, install from github
> npm install aimingoo/metameta

And use in javascript

// Meta core
var {Meta, MetaClass, MetaObject} = require('@aimingoo/metameta');

// Helper methods, all home object safed.
var {isMeta, isAtom, asAtom} = Meta;

// learn case
var Objext = Meta.from(Object);
console.log(Objext.keys(new Objext)); // []
console.log(Meta.isAtom(new Objext)); // true

The Meta

atom

The atom is smallest unit of pure object in javascript, it's object but not inherited from Object(). An atom is a object. null, Object.prototype, arguments and namespace are atom objects in javascript language.

> Meta.isAtom(null);
true

> Meta.isAtom(Object.prototype)
true

meta/Atom

atom created by meta, so the meta is constructor of atoms, with Atom() on the concept is the same. meta is base unit of Meta system, and is function always.

# meta is same of Atom()
> meta = new Meta; 

# atom created
> atom = new meta;

# check is atom
> Meta.isAtom(atom);
true

# check is object
> typeof atom;
'object'

Meta

Meta is meta's class.

// extend
class MetaX extends Meta {};
var meta = new MetaX;

// meta is atom too.
console.log(Meta.isAtom(new Meta)); // true
console.log(Meta.isAtom(meta)); // true

// instance from meta, check inheritance
var x = new meta;
console.log(x instanceof meta); // true
console.log(x instanceof Meta); // true
console.log(x instanceof MetaX); // true
// another
class MetaX2 extends Meta {};
console.log(x instanceof MetaX2); // false

MetaClass

MetaClass is root of Meta-classes programming system.

// meta-classes
class MetaClassEx extends MetaClass {
    // ...
}

// extend meta system
//  NOTE: must extends from a meta/Atom
class AtomObjects extends new MetaClassEx() {
    // ...
}

// check
console.log(MetaClass.isClassOf(MetaClassEx)); // true
console.log(MetaClassEx.isClassOf(AtomObjects)); // true
console.log(MetaClassEx.isClassOf(new AtomObjects)); // true
// another
console.log(MetaClassEx.isClassOf(new MetaObject)); // false

MetaObject

MetaObject is a meta of MetaClass, and is a Class/Atom-constructor of atoms.

// MetaObject is defined in metameta
var obj = new MetaObject;
console.log(Meta.isAtom(obj)); // true

// extend object system
class MetaObjectEx extends MetaObject{}

// create atom
var x = new MetaObjectEx;

// check
console.log(MetaClass.isClassOf(MetaObject)); // true
console.log(MetaClass.isClassOf(MetaObjectEx)); // true
console.log(MetaClass.isClassOf(x)); // true

// check in pure javascript
console.log(x instanceof MetaObject); // true
console.log(x instanceof MetaObjectEx); // true
console.log(x instanceof MetaObject); // true
console.log(x instanceof MetaClass); // true
console.log(x instanceof Meta); // true

// more
var isPrototypeOf = (...args) => Object.prototype.isPrototypeOf.call(...args);
console.log(isPrototypeOf(MetaObject, MetaObjectEx)); // true
console.log(isPrototypeOf(MetaClass, MetaObject)); // false
console.log(isPrototypeOf(MetaClass, MetaObjectEx)); // false

Shadow meta

A shadow is meta from native constructor.

// shadow from native-constructor
var Objext = Meta.from(Object);

// shadow is meta
var x = new Objext;
console.log(Meta.isAtom(x)); // true

// shadow has static methods from source
console.log(Objext.keys(x)); // []

More testcases

# pull source
> git clone https://github.com/aimingoo/metameta
> cd metameta
> npm install

# test
> npm test

# coverage
> npm -g install istanbul
> npm run coverage

Interface

  • Meta's Class methods

    // Return a object is atom object
    // @param {object|function} - a object
    Meta.isAtom(x)
    
    // Return a new atom/Atom, it's proxy of x, and prototype by base.
    // @param {object}[object] - a atom base another atom object
    // @param {function}[function=Atom] - a meta base meta/Meta/Atom...
    Meta.asAtom(x, base)
    
    // Return a class is Meta
    // @param {function} - a class
    Meta.isMeta(cls)
    
    // Return a shadow meta for native-constructor
    // @param {function} - a native constructor
    Meta.from(constructor)
  • MetaClass's Class methods

    // Return the class is base of x
    // @param {object} - is instance of class
    // @param {function} - is sub-class of class
    MetaClass.isClassOf(x)
  • extends from Meta

    class MetaX extends Meta {}
  • meta's extends

    // Meta-classes programming framework based
    class X extends new MetaClass {}
    
    // OR
    class X extends new MetaX{}

History

2018.08.17 - v0.9.1 released, happy Chinese traditional valentine's day.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].