plugin-utils
The plugin adds extended utility functions to your application's thorin.util
Installation and usage
npm i --save thorin-plugin-utils@1.x
'use strict';
// app.js entry file
const thorin = require('thorin');
thorin.addPlugin(require('thorin-plugin-utils')); // <- add this line
thorin.run((err) => {});
Plugin functionality
thorin.util.getDomainRoot(fullDomain) : String
Returns the root domain of the given domain, or null if it is invalid.
some.example.com -> example.com
google.com -> google.com
some.other.misc.domain.co.uk -> domain.co.uk
invalid-domain -> null
thorin.util.getDomainTld(fullDomain) : String
Returns the top-level-domain (com, com.uk, net, etc) for the given full domain
thorin.util.getSubdomain(fullDomain)
Returns the sub-domain of the given domain
some.example.com -> some
google.com -> null
thorin.util.minifyCss(source) : Promise
Performs CSS cleaning and minification