Socket
Socket
Sign inDemoInstall

fela-plugin-unit

Package Overview
Dependencies
Maintainers
1
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-plugin-unit - npm Package Compare versions

Comparing version 1.0.0-beta.2 to 1.0.1

105

dist/fela-plugin-unit.js

@@ -33,97 +33,13 @@ (function (global, factory) {

var emptyFunction = __commonjs(function (module) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
var warning = function warning() {
return true;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
});
var require$$0 = (emptyFunction && typeof emptyFunction === 'object' && 'default' in emptyFunction ? emptyFunction['default'] : emptyFunction);
var warning = __commonjs(function (module) {
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
'use strict';
var emptyFunction = require$$0;
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (true) {
warning = function warning(condition, format) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
warning = function warning(condition, message) {
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
console.error(message); // eslint-disable-line
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
throw new Error(message);
}

@@ -133,7 +49,4 @@ };

module.exports = warning;
});
var warning$1 = warning;
var warning$1 = (warning && typeof warning === 'object' && 'default' in warning ? warning['default'] : warning);
var index$1 = __commonjs(function (module) {

@@ -152,6 +65,6 @@ 'use strict';

var require$$0$1 = (index$1 && typeof index$1 === 'object' && 'default' in index$1 ? index$1['default'] : index$1);
var require$$0 = (index$1 && typeof index$1 === 'object' && 'default' in index$1 ? index$1['default'] : index$1);
var index = __commonjs(function (module) {
var hyphenateStyleName = require$$0$1;
var hyphenateStyleName = require$$0;

@@ -265,3 +178,3 @@ var unitlessProperties = {

};
})
});

@@ -268,0 +181,0 @@ return unit;

2

dist/fela-plugin-unit.min.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.FelaPluginUnit=e()}(this,function(){"use strict";function t(t,e){return e={exports:{}},t(e,e.exports),e.exports}function e(t,e,n){var r="undefined"==typeof e?"undefined":o["typeof"](e);return("number"===r||"string"===r&&e==parseFloat(e))&&(e+=n),e}function n(t,o){return Object.keys(t).forEach(function(r){if(!c(r)){var i=t[r];Array.isArray(i)?t[r]=i.map(function(t){return e(r,t,o)}):i instanceof Object?t[r]=n(i,o):t[r]=e(r,i,o)}}),t}var o={};o["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},o["extends"]=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t};var r=t(function(t){function e(t){return function(){return t}}var n=function(){};n.thatReturns=e,n.thatReturnsFalse=e(!1),n.thatReturnsTrue=e(!0),n.thatReturnsNull=e(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(t){return t},t.exports=n}),i=r&&"object"==typeof r&&"default"in r?r["default"]:r,u=(t(function(t){var e=i,n=e;t.exports=n}),t(function(t){function e(t){return t.replace(n,"-$&").toLowerCase().replace(o,"-ms-")}var n=/[A-Z]/g,o=/^ms-/;t.exports=e})),f=u&&"object"==typeof u&&"default"in u?u["default"]:u,a=t(function(t){function e(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)}var n=f,o={borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},r={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,order:!0,lineClamp:!0},i=["Webkit","ms","Moz","O"];Object.keys(r).forEach(function(t){o[t]=!0,i.forEach(function(n){o[e(n,t)]=!0})}),Object.keys(o).forEach(function(t){o[n(t)]=!0}),t.exports=function(t){return o[t]}}),c=a&&"object"==typeof a&&"default"in a?a["default"]:a,s=function(){var t=arguments.length<=0||void 0===arguments[0]?"px":arguments[0];return function(e){return n(e,t)}};return s});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.FelaPluginUnit=t()}(this,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}function t(e,t,o){var r="undefined"==typeof t?"undefined":n["typeof"](t);return("number"===r||"string"===r&&t==parseFloat(t))&&(t+=o),t}function o(e,n){return Object.keys(e).forEach(function(r){if(!u(r)){var i=e[r];Array.isArray(i)?e[r]=i.map(function(e){return t(r,e,n)}):i instanceof Object?e[r]=o(i,n):e[r]=t(r,i,n)}}),e}var n={};n["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},n["extends"]=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e};var r=e(function(e){function t(e){return e.replace(o,"-$&").toLowerCase().replace(n,"-ms-")}var o=/[A-Z]/g,n=/^ms-/;e.exports=t}),i=r&&"object"==typeof r&&"default"in r?r["default"]:r,f=e(function(e){function t(e,t){return e+t.charAt(0).toUpperCase()+t.slice(1)}var o=i,n={borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},r={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,order:!0,lineClamp:!0},f=["Webkit","ms","Moz","O"];Object.keys(r).forEach(function(e){n[e]=!0,f.forEach(function(o){n[t(o,e)]=!0})}),Object.keys(n).forEach(function(e){n[o(e)]=!0}),e.exports=function(e){return n[e]}}),u=f&&"object"==typeof f&&"default"in f?f["default"]:f,a=function(){var e=arguments.length<=0||void 0===arguments[0]?"px":arguments[0];return function(t){return o(t,e)}};return a});
{
"name": "fela-plugin-unit",
"version": "1.0.0-beta.2",
"version": "1.0.1",
"description": "Fela plugin to automatically add units if required",

@@ -5,0 +5,0 @@ "main": "index.js",

# fela-plugin-unit
<img alt="npm downloads" src="https://img.shields.io/npm/dm/fela-plugin-unit.svg">
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-1.08kb-brightgreen.svg">
Always writing length values as string with a value applied seems not like the JavaScript way to do it. You can also use mathematics to process number values. <br>
It is aware of unitless properties such as `lineHeight` and also adds units to multiple values inside an array.
## Installation
```sh
npm i --save fela-plugin-unit
```
Assuming you are using [npm](https://www.npmjs.com) as your package mananger you can just `npm install`.<br>
Otherwise we also provide a [UMD](https://github.com/umdjs/umd). You can easily use it via [npmcdn](https://npmcdn.com/). It registers a `FelaPluginUnit` global.
```HTML
<!-- Fela (Development): Unminified version including all warnings -->
<script src="https://npmcdn.com/fela-plugin-unit@1.0.1/dist/fela-plugin-unit.js"></script>
<!-- Fela (Production): Minified version -->
<script src="https://npmcdn.com/fela-plugin-unit@1.0.1/dist/fela-plugin-unit.min.js"></script>
```
## Example
Let's say we want to have a custom property `size` that accepts a single number which will then be transformed into both `width` and `height` with a `px` unit applied.
#### Input
```javascript

@@ -14,3 +34,3 @@ {

```
would be transformed into:
#### Output
```javascript

@@ -23,4 +43,4 @@ {

```
## Configuration
### Configuration
By default it adds `px` to the value, but you may use units other than that.

@@ -32,1 +52,6 @@ ```javascript

```
## License
Fela is licensed under the [MIT License](http://opensource.org/licenses/MIT).<br>
Documentation is licensed under [Creative Common License](http://creativecommons.org/licenses/by/4.0/).<br>
Created with ♥ by [@rofrischmann](http://rofrischmann.de) and all the great contributors.

Sorry, the diff of this file is not supported yet

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