js-models-helper
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

jsapi-torchiodev.com

Typescript/Javascript data model classes

Typescript files in src folder.

index.ts exports every module.

Mirrorred Javascript generated in dist folder

package.main points to dist/index, exporting all files

Models

Model (base)

  interface Metadata {
    [key: string]: any;
  }
  meta:Metadata = {}
  // stores any metadata, usually:
  //  sort: number = 0; // item order
  //  tags: Tags = new Tags(); // meta tags
  //  synonyms: Tags = new Tags();
  //  description: string; // meta description
 
  // copies itself into a child instance
  copyInto<T extends Model>(Typenew (idnumber | string) => T)T;

Image

 
  interface ISrcset = {url:string, size:[string, number]}
 
  titlestring = '';
  namestring = '';
  main_url:string = '';
  widthnumber = 0;
  heightnumber = 0;
  srcsetISrcset[] = []; // size: [label, value]
 
  addSource(src:ISrcset):itself; // add new image source to srcset

Tags

  collectionstring[] = [];

Package Sidebar

Install

npm i js-models-helper

Weekly Downloads

0

Version

2.0.1

License

ISC

Unpacked Size

7.59 kB

Total Files

19

Last publish

Collaborators

  • pedrotorchio