Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

z-utils

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

z-utils - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

21

index.js

@@ -5,2 +5,5 @@ 'use strict';

var isClient = typeof window === 'object' && !!window && window === window.window;
var isServer = !isClient;
var AP = Array.prototype;

@@ -126,5 +129,3 @@ var OP = Object.prototype;

*/
var global$1 = (function () {
return this || (typeof global === 'object' && global && global.global === global ? global : window)
})();
var global = new Function('return this || (typeof global === "object" && global && global.global === global ? global : window)')();

@@ -197,3 +198,2 @@ if (!isNativeFunction(Array.isArray)) {

}
for (var k$2 in object) {}
return k === undefined || hasOwnProperty.call(object, k)

@@ -204,5 +204,2 @@ }

var unableEnumerateOwnKeys, key;
for (key in {toString: 1}) { break }
// IE 某些属性即便为自身属性也无法枚举
key || (unableEnumerateOwnKeys = 'constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf'.split(' '));

@@ -302,3 +299,3 @@

sNamespace = root;
root = global$1;
root = global;
}

@@ -381,8 +378,10 @@

create: create,
global: global$1,
global: global,
hasOwnProperty: hasOwnProperty,
isArray: isArray,
isClient: isClient,
isEmptyObject: isEmptyObject,
isNativeFunction: isNativeFunction,
isPlainObject: isPlainObject,
isServer: isServer,
keys: keys,

@@ -404,3 +403,3 @@ merge: merge,

exports.create = create;
exports.global = global$1;
exports.global = global;
exports.isArray = isArray;

@@ -417,2 +416,4 @@ exports.isEmptyObject = isEmptyObject;

exports['default'] = index;
exports.isClient = isClient;
exports.isServer = isServer;
exports.arrayForEach = arrayForEach;

@@ -419,0 +420,0 @@ exports.arraySlice = arraySlice;

{
"name": "z-utils",
"version": "1.5.1",
"version": "1.6.0",
"description": "javascript uitls",

@@ -26,11 +26,11 @@ "scripts": {

"devDependencies": {
"rollup": "^0.41.4",
"rollup-plugin-babel": "^2.7.1",
"rollup": "^0.49.1",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-commonjs": "^7.0.0",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-commonjs": "^8.2.0",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-uglify": "^1.0.1",
"uglify-js": "^2.7.5"
"rollup-plugin-uglify": "^2.0.1",
"uglify-js": "^3.0.28"
}
}

@@ -16,3 +16,3 @@ // 项目下直接运行命令 rollup -c

module.exports = {
entry: 'src/index.js',
input: 'src/index.js', // entry -> input
plugins: [

@@ -35,3 +35,3 @@ // resolve({

exclude: 'node_modules/**',
ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
ENV: JSON.stringify(process.env.NODE_ENV || 'development')
})

@@ -42,18 +42,18 @@ ],

{
dest: 'index.js',
file: 'index.js', // dest -> file
format: 'cjs'
}/*, {
dest: 'utils.amd.js',
file: 'utils.amd.js',
format: 'amd'
}, {
dest: 'utils.cjs.js',
file: 'utils.cjs.js',
format: 'cjs'
}, {
dest: 'utils.es.js',
file: 'utils.es.js',
format: 'es'
}, {
dest: 'utils.iife.js',
file: 'utils.iife.js',
format: 'iife'
}, {
dest: 'utils.umd.js',
file: 'utils.umd.js',
format: 'umd'

@@ -64,5 +64,5 @@ }*/

// format: 'iife', // cjs amd es6 umd iife
moduleName: 'utils', // umd 或 iife 模式下,若入口文件含 export,必须加上该属性
// dest: 'utils.js', // 输出文件
// sourceMap: false // 调试编译
name: 'utils' // umd 或 iife 模式下,若入口文件含 export,必须加上该属性 moduleName -> name
// file: 'utils.js', // 输出文件 dest -> file
// sourcemap: false // 调试编译 sourceMap -> sourcemap
}

@@ -8,3 +8,3 @@ // 项目下直接命令$ node rollup.js

const rc = {
entry: rollupConfig.entry,
input: rollupConfig.input, // entry -> input
plugins: rollupConfig.plugins

@@ -14,8 +14,8 @@ }

let targets = rollupConfig.targets ? rollupConfig.targets.map(target => ({
format: target.format,
dest: target.dest
})) : [{
format: rollupConfig.format,
dest: rollupConfig.dest
}]
format: target.format,
file: target.file // dest -> file
})) : [{
format: rollupConfig.format,
file: rollupConfig.file // dest -> file
}]

@@ -25,4 +25,4 @@ const noBannerFormats = {'cjs': !0, 'es': !0}

target.banner = noBannerFormats[target.format] ? '' : this.banner
target.moduleName = this.moduleName
target.sourceMap = this.sourceMap
target.name = this.name // moduleName -> name
target.sourcemap = this.sourcemap // sourceMap -> sourcemap
}, rollupConfig)

@@ -35,3 +35,3 @@

*/
function minify(code) {
function minify (code) {
let minifyOptions = {

@@ -47,14 +47,13 @@ fromString: true

targets.forEach(target => {
let result = bundle.generate(target)
bundle.generate(target).then(({code, map}) => {
// file 生成的目标文件 dest -> file
fs.writeFileSync(target.file, code)
// dest 生成的目标文件
fs.writeFileSync(target.dest, result.code)
// 若指定压缩最小化文件
if (target.minimize) {
let minMain = target.dest.replace(/(?=\.js$)/, '.min')
minMain === target.dest && (minMain += '.min')
fs.writeFileSync(minMain, target.banner + minify(result.code))
}
// 若指定压缩最小化文件
if (target.minimize) {
let minMain = target.file.replace(/(?=\.js$)/, '.min')
minMain === target.file && (minMain += '.min')
fs.writeFileSync(minMain, target.banner + minify(code))
}
})
})

@@ -61,0 +60,0 @@

@@ -0,1 +1,4 @@

export const isClient = typeof window === 'object' && !!window && window === window.window
export const isServer = !isClient
const AP = Array.prototype

@@ -2,0 +5,0 @@ const OP = Object.prototype

@@ -5,4 +5,2 @@ /**

*/
export default (function () {
return this || (typeof global === 'object' && global && global.global === global ? global : window)
})()
export default new Function('return this || (typeof global === "object" && global && global.global === global ? global : window)')()

@@ -14,3 +14,3 @@ import assign from './assign'

import uuid from './uuid'
import {arrayForEach, arraySlice, hasOwnProperty, noop, referenceTypes, returnFalse, returnTrue, support__proto__, toString} from './core'
import {arrayForEach, arraySlice, hasOwnProperty, isClient, isServer, noop, referenceTypes, returnFalse, returnTrue, support__proto__, toString} from './core'

@@ -43,5 +43,7 @@ export * from './core'

isArray,
isClient,
isEmptyObject,
isNativeFunction,
isPlainObject,
isServer,
keys,

@@ -48,0 +50,0 @@ merge,

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