Socket
Socket
Sign inDemoInstall

is-what

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-what - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

dist/index.cjs.js

56

build/rollup.js
// ------------------------------------------------------------------------------------------
// formats
// ------------------------------------------------------------------------------------------
// cjs – CommonJS, suitable for Node and Browserify/Webpack
// es – Keep the bundle as an ES module file
// iife – A self-executing function, suitable for inclusion as a <script> tag. (If you want to create a bundle for your application, you probably want to use this, because it leads to smaller file sizes.)
// umd – Universal Module Definition, works as amd, cjs and iife all in one
// ------------------------------------------------------------------------------------------
// setup

@@ -7,34 +15,40 @@ // ------------------------------------------------------------------------------------------

import { uglify } from 'rollup-plugin-uglify'
import { terser } from "rollup-plugin-terser";
const pkg = require('../package.json')
const name = 'index'
const name = pkg.name
const className = name.replace(/(^\w|-\w)/g, c => c.replace('-', '').toUpperCase())
const external = Object.keys(pkg.dependencies || [])
function output (ext, format = 'umd') {
function output (ext, format) {
return {
name: className,
file: `dist/${name}.${ext}`,
format: format,
sourcemap: true,
exports: 'named'
exports: 'named',
file: `dist/index.${ext}`,
format
}
}
function buildTemplate (format, minified = false) {
const plugins = (minified)
? [babel(), commonjs(), terser()]
: [babel(), commonjs()]
const ext = (minified)
? `${format}.min.js`
: `${format}.js`
return {
input: `src/index.js`,
output: output(ext, format),
plugins,
external
}
}
// ------------------------------------------------------------------------------------------
// build
// builds
// ------------------------------------------------------------------------------------------
const umd = {
input: 'src/index.js',
output: output('js'),
plugins: [
babel(),
commonjs()
]
}
const formats = ['umd', 'cjs', 'es', 'iife']
const regBuilds = formats.map(format => buildTemplate(format))
const minBuilds = formats.map(format => buildTemplate(format, true))
const result = regBuilds.concat(minBuilds)
const min = Object.assign({}, umd, {
output: output('min.js'),
plugins: [...umd.plugins, uglify()]
})
export default [umd, min]
export default result
{
"name": "is-what",
"version": "1.0.3",
"version": "1.0.4",
"description": "Very simple & small JS type check function",
"main": "dist/index.min.js",
"main": "dist/index.cjs.min.js",
"module": "dist/index.es.min.js",
"scripts": {

@@ -32,4 +33,5 @@ "test": "echo \"Error: no test specified\" && exit 1",

"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-terser": "^1.0.1",
"rollup-plugin-uglify": "^4.0.0"
}
}

@@ -33,3 +33,3 @@

module.exports = {
export {
getType,

@@ -44,3 +44,3 @@ isUndefined,

isRegExp,
isDate,
isDate
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc