@thefoxjob/js-meta

1.0.0 • Public • Published

Js Meta

Keeps track of various kinds of meta data about a class or a method, without manipulating the target.

Behind the scene, a WeakMap is used to store the information.

Contents

How to install

npm install @aedart/js-meta

Quick start

import Meta from '@aedart/js-meta';

class MyClass {
    // ... body not shown ..//
}

// Add arbitrary data about MyClass
Meta.addClass(MyClass, {
    name: 'MyClass',
    description: 'Yarr, swashbuckling strength!',
    maxLifetime: 23
});

// Obtain arbitrary data about MyClass
let metaData = Meta.get(MyClass); // Returns "@aedart/js-meta/src/Meta/ClassData" object

console.log(metaData.data);
// Outputs:
//  {
//        name: 'MyClass',
//        description: 'Yarr, swashbuckling strength!',
//        maxLifetime: 23
//   }

Please review internal documentation (@aedart/js-meta/src/Meta.js) for additional API information.

License

BSD-3-Clause, Read the LICENSE file included in this package

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    3
  • 0.0.2
    1

Package Sidebar

Install

npm i @thefoxjob/js-meta

Weekly Downloads

4

Version

1.0.0

License

BSD-3-Clause

Last publish

Collaborators

  • thefoxjob