0.0.0 ā€¢ Published 2 years ago

@genious/g9 v0.0.0

Weekly downloads
-
License
MPL-2.0
Repository
github
Last release
2 years ago

@genious/g9

šŸ”‘ Unique property keys.

Installation

Install G9 using your favorite package manager.

$ npm i @genious/g9

Usage

To use one of the keys, e.g. dataName, import the submodule from the parent module.

import { dataName } from '@genious/g9';

Or import the key using the appropriate subpath.

import dataName from '@genious/g9/dataName';

dataName

Symbol that specifies the name of the file (String or URL) at the origin of Data object.

  • type {symbol}
class Data {
  #srcName;

  constructor(name) {
    this.#srcName = name;
  }

  get [dataName]() {
    return this.#srcName;
  }

  static readFile(path) {
    return new Data(path);
  }
}
const obj = Data.readFile('./hello.md');

console.log(obj[dataName]);
// './hello.md'

Authors

Aziz Da azizdawhat@gmail.com

License

MPL-2.0