@svizzle/dev/common

Methods

(static) makeBanner(package) → {string}

Source:
Since:
  • 0.1.0

Return a string modifying the input filepath extension to .mjs. Used to get the location of the es6 build from the JS build: component.js -> component.mjs

Example
> import pkg from 'package.json'
> makeBanner(pkg)
'svizzle v0.1.0 - © 2023 nestauk'
Parameters:
Name Type Description
package obj

object representation of package.json

Returns:
  • banner
Type
string

(static) renameToCss(filepath) → {string}

Source:
Since:
  • 0.1.0

Return a string modifying the input filepath extension to .css. Used to get the location of the CSS build from the JS build: component.js -> component.css

Example
> renameToCss('filename.js')
'filename.css'
Parameters:
Name Type Description
filepath string
Returns:
Type
string

(static) renameToExtension(extension) → {string}

Source:
Since:
  • 0.2.0

Return a function expecting the filepath to rename

Example
> renameToFoo = renameToExtension('.foo')
> renameToFoo('filename.txt')
'filename.foo'
> renameToFoo('filename.spec.txt')
'filename.spec.foo'
Parameters:
Name Type Description
extension string
Returns:
Type
string

(static) renameToMinJs(filepath) → {string}

Source:
Since:
  • 0.1.0

Return a string modifying the input filepath extension to .min.js. Used to get the location of the minified build from the JS build: component.js -> component.min.js

Example
> renameToMinJs('filename.js')
'filename.min.js'
Parameters:
Name Type Description
filepath string
Returns:
Type
string

(static) renameToMjs(filepath) → {string}

Source:
Since:
  • 0.1.0

Return a string modifying the input filepath extension to .mjs. Used to get the location of the es6 build from the JS build: component.js -> component.mjs

Example
> renameToCss('filename.js')
'filename.mjs'
Parameters:
Name Type Description
filepath string
Returns:
Type
string