Socket
Socket
Sign inDemoInstall

nuke-helper

Package Overview
Dependencies
0
Maintainers
2
Versions
58
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.2 to 2.0.3

4

HISTORY.md
# Changelog
## 2.0.3 / 2018-04-25
* [[e3f90c4](http://gitlab.alibaba-inc.com/nuke/helper/commit/e3f90c4500b2f2dbce25c8e8f0591eae48e0accb)] - `feat` remove useless env
## 2.0.2 / 2018-04-10

@@ -5,0 +9,0 @@

6

lib/calc-fixed-font.js

@@ -9,6 +9,6 @@ 'use strict';

var _universalEnv = require('universal-env');
var isWeb = typeof callNative !== 'function';
var isIpad = void 0;
if (_universalEnv.isWeb) {
if (isWeb) {
isIpad = navigator.userAgent.indexOf('iPad') > -1;

@@ -63,3 +63,3 @@ } else {

}
result.fontSize = fontSize + (_universalEnv.isWeb ? 'px' : 'wx');
result.fontSize = fontSize + (isWeb ? 'px' : 'wx');
if (isIpad && fitPad) {}

@@ -66,0 +66,0 @@ return result;

@@ -6,11 +6,10 @@ 'use strict';

});
var isWeb = typeof callNative !== 'function';
var _universalEnv = require('universal-env');
exports.default = function (unit) {
var num = parseInt(unit, 10);
if (num > 6) return unit;
return '' + Math.floor(num / 2).toString() + (_universalEnv.isWeb ? 'px' : 'wx');
return '' + Math.floor(num / 2).toString() + (isWeb ? 'px' : 'wx');
};
module.exports = exports['default'];

@@ -7,4 +7,2 @@ 'use strict';

var _universalEnv = require('universal-env');
var _borderSeperate = require('./border-seperate');

@@ -16,12 +14,14 @@

var isWeb = typeof callNative !== 'function';
var hairLine = {};
/**
* 设备是否支持 0.5px
* decide if container support 0.5px in web env
* @return {boolean} supportFlag
*/
* 设备是否支持 0.5px
* decide if container support 0.5px in web env
* @return {boolean} supportFlag
*/
hairLine.detect = function () {
var hairLineFlag = void 0;
if (!_universalEnv.isWeb) return true;
if (!isWeb) return true;
if (window.OffsetHeightForRxBorder) {

@@ -52,3 +52,3 @@ hairLineFlag = window.OffsetHeightForRxBorder;

hairLine.fixBorder = function (style) {
if (!_universalEnv.isWeb) return style;
if (!isWeb) return style;
var borderWidthHair = hairLine.detect() ? '0.5px' : '1px';

@@ -55,0 +55,0 @@ style = (0, _borderSeperate2.default)(style, ['Width']);

@@ -7,4 +7,2 @@ 'use strict';

var _rax = require('rax');
var _calcFixedFont = require('./calc-fixed-font');

@@ -11,0 +9,0 @@

@@ -5,4 +5,3 @@ 'use strict';

var _universalEnv = require('universal-env');
var isWeex = typeof callNative === 'function';
/**

@@ -18,3 +17,3 @@ * @description parse rem to even px to solve andoird float px issue.

}
if (_universalEnv.isWeex) return rem;
if (isWeex) return rem;
rem = exports.removeRemUnit(rem);

@@ -25,5 +24,4 @@ var defaultPixUnit = document.documentElement.clientWidth / defaultWidth;

return num + 'px';
} else {
return num - 1 + 'px';
}
return num - 1 + 'px';
};

@@ -30,0 +28,0 @@ /**

{
"name": "nuke-helper",
"version": "2.0.2",
"version": "2.0.3",
"description": "辅助函数",

@@ -48,8 +48,12 @@ "main": "lib/index",

},
"dependencies": {
"universal-env": "^0.4.20"
},
"dependencies": {},
"devDependencies": {
"nuke-view": "^x.x.x",
"nuke-text": "^x.x.x"
"nuke-text": "^x.x.x",
"eslint": "3.19.0",
"babel-eslint": "^7.2.3",
"eslint-config-ali": "2.0.0",
"eslint-plugin-import": "2.6.0",
"eslint-plugin-jsx-a11y": "6.0.2",
"eslint-plugin-react": "7.1.0"
},

@@ -56,0 +60,0 @@ "publishConfig": {

@@ -1,2 +0,1 @@

/**

@@ -38,3 +37,2 @@ * 用来处理 weex 下,同时有 borderWidth 和 borderTopWidth 时,weex 表现异常的问题

return style;
}
};

@@ -1,2 +0,3 @@

import { isWeb } from 'universal-env';
const isWeb = typeof callNative !== 'function';
let isIpad;

@@ -3,0 +4,0 @@ if (isWeb) {

@@ -1,7 +0,7 @@

import { isWeb } from 'universal-env';
const isWeb = typeof callNative !== 'function';
export default unit => {
let num = parseInt(unit, 10);
export default (unit) => {
const num = parseInt(unit, 10);
if (num > 6) return unit;
return `${Math.floor(num / 2).toString()}${isWeb ? 'px' : 'wx'}`;
};

@@ -1,13 +0,11 @@

import { isWeb } from 'universal-env';
const isWeb = typeof callNative !== 'function';
import seperate from './border-seperate';
var hairLine = {};
const hairLine = {};
/**
* 设备是否支持 0.5px
* decide if container support 0.5px in web env
* @return {boolean} supportFlag
*/
* 设备是否支持 0.5px
* decide if container support 0.5px in web env
* @return {boolean} supportFlag
*/
hairLine.detect = () => {
let hairLineFlag;

@@ -60,4 +58,3 @@ if (!isWeb) return true;

return style;
}
};
export default hairLine;

@@ -6,8 +6,8 @@ /**

exports.valueToObj = function(obj) {
Object.keys(obj).map(name => {
exports.valueToObj = function (obj) {
Object.keys(obj).map((name) => {
if (typeof obj[name] === 'object') {
obj[name] = {
name,
raw: obj[name]
raw: obj[name],
};

@@ -18,3 +18,3 @@ }

};
exports.hexToRgb = function(hex, opacity) {
exports.hexToRgb = function (hex, opacity) {
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;

@@ -29,3 +29,3 @@ hex = hex.replace(shorthandRegex, (m, r, g, b) => r + r + g + g + b + b);

g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
b: parseInt(result[3], 16),
};

@@ -37,3 +37,3 @@ };

*/
exports.rgba = function(hex, opacity) {
exports.rgba = function (hex, opacity) {
if (typeof hex === 'object' && 'raw' in hex) {

@@ -40,0 +40,0 @@ hex = hex.raw;

'use strict';
import { createElement, Component, PropTypes } from 'rax';
import calcTextSize from './calc-fixed-font';

@@ -22,3 +22,3 @@ import hairLine from './hair-line';

layout,
rem
rem,
};

@@ -1,2 +0,2 @@

exports.alignCenter = function() {
exports.alignCenter = function () {
return {

@@ -6,4 +6,4 @@ display: 'flex',

alignItems: 'center',
justifyContent: 'center'
justifyContent: 'center',
};
};

@@ -1,6 +0,6 @@

import { isWeex } from 'universal-env';
const isWeex = typeof callNative === 'function';
/**
* @description parse rem to even px to solve andoird float px issue.
*/
exports.caculateRemToPx = function(rem, defaultWidth = 750) {
exports.caculateRemToPx = function (rem, defaultWidth = 750) {
// Default 1 rem to 1 px

@@ -12,9 +12,8 @@ if (typeof rem === 'object' && 'raw' in rem) {

rem = exports.removeRemUnit(rem);
let defaultPixUnit = document.documentElement.clientWidth / defaultWidth;
let num = Math.round(parseFloat(rem) * defaultPixUnit);
const defaultPixUnit = document.documentElement.clientWidth / defaultWidth;
const num = Math.round(parseFloat(rem) * defaultPixUnit);
if (num % 2 === 0) {
return num + 'px';
} else {
return num - 1 + 'px';
return `${num}px`;
}
return `${num - 1}px`;
};

@@ -25,5 +24,5 @@ /**

*/
exports.removeRemUnit = function(rem) {
exports.removeRemUnit = function (rem) {
rem = String(rem);
return rem.replace('rem', '');
};

@@ -8,3 +8,3 @@ export default [

'textAlign',
'textDecoration'
'textDecoration',
];
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc