1.0.0 • Published 5 months ago

@ewizardjs/banner-structure-api v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

BANNER STRUCTURE API

Banner structure api is a set of methods that will simplify working with banner array and banners structure.

Install banner-structure-api with npm

  npm i @ewizardjs/banner-structure-api

Usage/Examples

In your ".ts"/".js" files:

import {
  getBanners,
  makeStructure,
} from '@ewizardjs/banner-structure-api';  
  
const structure = readJson('./structure.json');  
  
const bannersArray = getBanners(structure);  
const structureJson = makeStructure(bannersArray);  

Available Interfaces / Types / etc

NameFieldsDescription
Bannerid, name, size, template, thumbnailThe main fields of each banner
BannerSizewidth, height, dprDimensions of each banner
BannersJsonbannersJson file format with banners

Description of banner fields

NameDescriptionRequired field in json
idBanner idYes
nameBanner nameYes
sizeBanner size. Has type BannerSizeYes
templatePath to the banner templateNo
thumbnailPath to the banner thumbnailNo
widthBanner widthYes
heightBanner heightYes
dprDevice pixel ratioYes

API Reference

MethodArgumentsExecution resultDescription
getBannersbannersJson, optionsAn array of Banner type objectsGet information about all banners
makeStructurebannersArrayJSON of type BannersJsonGet new structure json from banners array

Arguments of the methods

NameDescription
bannersJsonstructure.json file content
optionsA set of options. May include systemSettings and callback fields
bannersArrayAn array of banners
systemSettingsFragment of the default paths object. Necessary for forming paths to the template and thumbnails in the banner type structures. Can be obtained from the "@ewizardjs/system-settings" module.
1.0.0

5 months ago