aboutsummaryrefslogtreecommitdiff
path: root/node_modules/clean-css/lib/options
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/clean-css/lib/options
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
remove node_modules
Diffstat (limited to 'node_modules/clean-css/lib/options')
-rw-r--r--node_modules/clean-css/lib/options/compatibility.js183
-rw-r--r--node_modules/clean-css/lib/options/fetch.js7
-rw-r--r--node_modules/clean-css/lib/options/format.js216
-rw-r--r--node_modules/clean-css/lib/options/inline-request.js22
-rw-r--r--node_modules/clean-css/lib/options/inline-timeout.js7
-rw-r--r--node_modules/clean-css/lib/options/inline.js15
-rw-r--r--node_modules/clean-css/lib/options/optimization-level.js221
-rw-r--r--node_modules/clean-css/lib/options/rebase-to.js7
-rw-r--r--node_modules/clean-css/lib/options/rebase.js5
-rw-r--r--node_modules/clean-css/lib/options/rounding-precision.js88
10 files changed, 0 insertions, 771 deletions
diff --git a/node_modules/clean-css/lib/options/compatibility.js b/node_modules/clean-css/lib/options/compatibility.js
deleted file mode 100644
index 8e6a119a8..000000000
--- a/node_modules/clean-css/lib/options/compatibility.js
+++ /dev/null
@@ -1,183 +0,0 @@
-var DEFAULTS = {
- '*': {
- colors: {
- opacity: true // rgba / hsla
- },
- properties: {
- backgroundClipMerging: true, // background-clip to shorthand
- backgroundOriginMerging: true, // background-origin to shorthand
- backgroundSizeMerging: true, // background-size to shorthand
- colors: true, // any kind of color transformations, like `#ff00ff` to `#f0f` or `#fff` into `red`
- ieBangHack: false, // !ie suffix hacks on IE<8
- ieFilters: false, // whether to preserve `filter` and `-ms-filter` properties
- iePrefixHack: false, // underscore / asterisk prefix hacks on IE
- ieSuffixHack: false, // \9 suffix hacks on IE6-9
- merging: true, // merging properties into one
- shorterLengthUnits: false, // optimize pixel units into `pt`, `pc` or `in` units
- spaceAfterClosingBrace: true, // 'url() no-repeat' to 'url()no-repeat'
- urlQuotes: false, // whether to wrap content of `url()` into quotes or not
- zeroUnits: true // 0[unit] -> 0
- },
- selectors: {
- adjacentSpace: false, // div+ nav Android stock browser hack
- ie7Hack: false, // *+html hack
- mergeablePseudoClasses: [
- ':active',
- ':after',
- ':before',
- ':empty',
- ':checked',
- ':disabled',
- ':empty',
- ':enabled',
- ':first-child',
- ':first-letter',
- ':first-line',
- ':first-of-type',
- ':focus',
- ':hover',
- ':lang',
- ':last-child',
- ':last-of-type',
- ':link',
- ':not',
- ':nth-child',
- ':nth-last-child',
- ':nth-last-of-type',
- ':nth-of-type',
- ':only-child',
- ':only-of-type',
- ':root',
- ':target',
- ':visited'
- ], // selectors with these pseudo-classes can be merged as these are universally supported
- mergeablePseudoElements: [
- '::after',
- '::before',
- '::first-letter',
- '::first-line'
- ], // selectors with these pseudo-elements can be merged as these are universally supported
- mergeLimit: 8191, // number of rules that can be safely merged together
- multiplePseudoMerging: true
- },
- units: {
- ch: true,
- in: true,
- pc: true,
- pt: true,
- rem: true,
- vh: true,
- vm: true, // vm is vmin on IE9+ see https://developer.mozilla.org/en-US/docs/Web/CSS/length
- vmax: true,
- vmin: true,
- vw: true
- }
- }
-};
-
-DEFAULTS.ie11 = DEFAULTS['*'];
-
-DEFAULTS.ie10 = DEFAULTS['*'];
-
-DEFAULTS.ie9 = merge(DEFAULTS['*'], {
- properties: {
- ieFilters: true,
- ieSuffixHack: true
- }
-});
-
-DEFAULTS.ie8 = merge(DEFAULTS.ie9, {
- colors: {
- opacity: false
- },
- properties: {
- backgroundClipMerging: false,
- backgroundOriginMerging: false,
- backgroundSizeMerging: false,
- iePrefixHack: true,
- merging: false
- },
- selectors: {
- mergeablePseudoClasses: [
- ':after',
- ':before',
- ':first-child',
- ':first-letter',
- ':focus',
- ':hover',
- ':visited'
- ],
- mergeablePseudoElements: []
- },
- units: {
- ch: false,
- rem: false,
- vh: false,
- vm: false,
- vmax: false,
- vmin: false,
- vw: false
- }
-});
-
-DEFAULTS.ie7 = merge(DEFAULTS.ie8, {
- properties: {
- ieBangHack: true
- },
- selectors: {
- ie7Hack: true,
- mergeablePseudoClasses: [
- ':first-child',
- ':first-letter',
- ':hover',
- ':visited'
- ]
- },
-});
-
-function compatibilityFrom(source) {
- return merge(DEFAULTS['*'], calculateSource(source));
-}
-
-function merge(source, target) {
- for (var key in source) {
- var value = source[key];
-
- if (typeof value === 'object' && !Array.isArray(value)) {
- target[key] = merge(value, target[key] || {});
- } else {
- target[key] = key in target ? target[key] : value;
- }
- }
-
- return target;
-}
-
-function calculateSource(source) {
- if (typeof source == 'object')
- return source;
-
- if (!/[,\+\-]/.test(source))
- return DEFAULTS[source] || DEFAULTS['*'];
-
- var parts = source.split(',');
- var template = parts[0] in DEFAULTS ?
- DEFAULTS[parts.shift()] :
- DEFAULTS['*'];
-
- source = {};
-
- parts.forEach(function (part) {
- var isAdd = part[0] == '+';
- var key = part.substring(1).split('.');
- var group = key[0];
- var option = key[1];
-
- source[group] = source[group] || {};
- source[group][option] = isAdd;
- });
-
- return merge(template, source);
-}
-
-module.exports = compatibilityFrom;
diff --git a/node_modules/clean-css/lib/options/fetch.js b/node_modules/clean-css/lib/options/fetch.js
deleted file mode 100644
index 0aaad7866..000000000
--- a/node_modules/clean-css/lib/options/fetch.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var loadRemoteResource = require('../reader/load-remote-resource');
-
-function fetchFrom(callback) {
- return callback || loadRemoteResource;
-}
-
-module.exports = fetchFrom;
diff --git a/node_modules/clean-css/lib/options/format.js b/node_modules/clean-css/lib/options/format.js
deleted file mode 100644
index 48c7efa8e..000000000
--- a/node_modules/clean-css/lib/options/format.js
+++ /dev/null
@@ -1,216 +0,0 @@
-var systemLineBreak = require('os').EOL;
-
-var override = require('../utils/override');
-
-var Breaks = {
- AfterAtRule: 'afterAtRule',
- AfterBlockBegins: 'afterBlockBegins',
- AfterBlockEnds: 'afterBlockEnds',
- AfterComment: 'afterComment',
- AfterProperty: 'afterProperty',
- AfterRuleBegins: 'afterRuleBegins',
- AfterRuleEnds: 'afterRuleEnds',
- BeforeBlockEnds: 'beforeBlockEnds',
- BetweenSelectors: 'betweenSelectors'
-};
-
-var BreakWith = {
- CarriageReturnLineFeed: '\r\n',
- LineFeed: '\n',
- System: systemLineBreak
-};
-
-var IndentWith = {
- Space: ' ',
- Tab: '\t'
-};
-
-var Spaces = {
- AroundSelectorRelation: 'aroundSelectorRelation',
- BeforeBlockBegins: 'beforeBlockBegins',
- BeforeValue: 'beforeValue'
-};
-
-var DEFAULTS = {
- breaks: breaks(false),
- breakWith: BreakWith.System,
- indentBy: 0,
- indentWith: IndentWith.Space,
- spaces: spaces(false),
- wrapAt: false,
- semicolonAfterLastProperty: false
-};
-
-var BEAUTIFY_ALIAS = 'beautify';
-var KEEP_BREAKS_ALIAS = 'keep-breaks';
-
-var OPTION_SEPARATOR = ';';
-var OPTION_NAME_VALUE_SEPARATOR = ':';
-var HASH_VALUES_OPTION_SEPARATOR = ',';
-var HASH_VALUES_NAME_VALUE_SEPARATOR = '=';
-
-var FALSE_KEYWORD_1 = 'false';
-var FALSE_KEYWORD_2 = 'off';
-var TRUE_KEYWORD_1 = 'true';
-var TRUE_KEYWORD_2 = 'on';
-
-function breaks(value) {
- var breakOptions = {};
-
- breakOptions[Breaks.AfterAtRule] = value;
- breakOptions[Breaks.AfterBlockBegins] = value;
- breakOptions[Breaks.AfterBlockEnds] = value;
- breakOptions[Breaks.AfterComment] = value;
- breakOptions[Breaks.AfterProperty] = value;
- breakOptions[Breaks.AfterRuleBegins] = value;
- breakOptions[Breaks.AfterRuleEnds] = value;
- breakOptions[Breaks.BeforeBlockEnds] = value;
- breakOptions[Breaks.BetweenSelectors] = value;
-
- return breakOptions;
-}
-
-function spaces(value) {
- var spaceOptions = {};
-
- spaceOptions[Spaces.AroundSelectorRelation] = value;
- spaceOptions[Spaces.BeforeBlockBegins] = value;
- spaceOptions[Spaces.BeforeValue] = value;
-
- return spaceOptions;
-}
-
-function formatFrom(source) {
- if (source === undefined || source === false) {
- return false;
- }
-
- if (typeof source == 'object' && 'breakWith' in source) {
- source = override(source, { breakWith: mapBreakWith(source.breakWith) });
- }
-
- if (typeof source == 'object' && 'indentBy' in source) {
- source = override(source, { indentBy: parseInt(source.indentBy) });
- }
-
- if (typeof source == 'object' && 'indentWith' in source) {
- source = override(source, { indentWith: mapIndentWith(source.indentWith) });
- }
-
- if (typeof source == 'object') {
- return override(DEFAULTS, source);
- }
-
- if (typeof source == 'object') {
- return override(DEFAULTS, source);
- }
-
- if (typeof source == 'string' && source == BEAUTIFY_ALIAS) {
- return override(DEFAULTS, {
- breaks: breaks(true),
- indentBy: 2,
- spaces: spaces(true)
- });
- }
-
- if (typeof source == 'string' && source == KEEP_BREAKS_ALIAS) {
- return override(DEFAULTS, {
- breaks: {
- afterAtRule: true,
- afterBlockBegins: true,
- afterBlockEnds: true,
- afterComment: true,
- afterRuleEnds: true,
- beforeBlockEnds: true
- }
- });
- }
-
- if (typeof source == 'string') {
- return override(DEFAULTS, toHash(source));
- }
-
- return DEFAULTS;
-}
-
-function toHash(string) {
- return string
- .split(OPTION_SEPARATOR)
- .reduce(function (accumulator, directive) {
- var parts = directive.split(OPTION_NAME_VALUE_SEPARATOR);
- var name = parts[0];
- var value = parts[1];
-
- if (name == 'breaks' || name == 'spaces') {
- accumulator[name] = hashValuesToHash(value);
- } else if (name == 'indentBy' || name == 'wrapAt') {
- accumulator[name] = parseInt(value);
- } else if (name == 'indentWith') {
- accumulator[name] = mapIndentWith(value);
- } else if (name == 'breakWith') {
- accumulator[name] = mapBreakWith(value);
- }
-
- return accumulator;
- }, {});
-}
-
-function hashValuesToHash(string) {
- return string
- .split(HASH_VALUES_OPTION_SEPARATOR)
- .reduce(function (accumulator, directive) {
- var parts = directive.split(HASH_VALUES_NAME_VALUE_SEPARATOR);
- var name = parts[0];
- var value = parts[1];
-
- accumulator[name] = normalizeValue(value);
-
- return accumulator;
- }, {});
-}
-
-
-function normalizeValue(value) {
- switch (value) {
- case FALSE_KEYWORD_1:
- case FALSE_KEYWORD_2:
- return false;
- case TRUE_KEYWORD_1:
- case TRUE_KEYWORD_2:
- return true;
- default:
- return value;
- }
-}
-
-function mapBreakWith(value) {
- switch (value) {
- case 'windows':
- case 'crlf':
- case BreakWith.CarriageReturnLineFeed:
- return BreakWith.CarriageReturnLineFeed;
- case 'unix':
- case 'lf':
- case BreakWith.LineFeed:
- return BreakWith.LineFeed;
- default:
- return systemLineBreak;
- }
-}
-
-function mapIndentWith(value) {
- switch (value) {
- case 'space':
- return IndentWith.Space;
- case 'tab':
- return IndentWith.Tab;
- default:
- return value;
- }
-}
-
-module.exports = {
- Breaks: Breaks,
- Spaces: Spaces,
- formatFrom: formatFrom
-};
diff --git a/node_modules/clean-css/lib/options/inline-request.js b/node_modules/clean-css/lib/options/inline-request.js
deleted file mode 100644
index 1e14c6393..000000000
--- a/node_modules/clean-css/lib/options/inline-request.js
+++ /dev/null
@@ -1,22 +0,0 @@
-var url = require('url');
-
-var override = require('../utils/override');
-
-function inlineRequestFrom(option) {
- return override(
- /* jshint camelcase: false */
- proxyOptionsFrom(process.env.HTTP_PROXY || process.env.http_proxy),
- option || {}
- );
-}
-
-function proxyOptionsFrom(httpProxy) {
- return httpProxy ?
- {
- hostname: url.parse(httpProxy).hostname,
- port: parseInt(url.parse(httpProxy).port)
- } :
- {};
-}
-
-module.exports = inlineRequestFrom;
diff --git a/node_modules/clean-css/lib/options/inline-timeout.js b/node_modules/clean-css/lib/options/inline-timeout.js
deleted file mode 100644
index c7fb454d5..000000000
--- a/node_modules/clean-css/lib/options/inline-timeout.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var DEFAULT_TIMEOUT = 5000;
-
-function inlineTimeoutFrom(option) {
- return option || DEFAULT_TIMEOUT;
-}
-
-module.exports = inlineTimeoutFrom;
diff --git a/node_modules/clean-css/lib/options/inline.js b/node_modules/clean-css/lib/options/inline.js
deleted file mode 100644
index 54761f40a..000000000
--- a/node_modules/clean-css/lib/options/inline.js
+++ /dev/null
@@ -1,15 +0,0 @@
-function inlineOptionsFrom(rules) {
- if (Array.isArray(rules)) {
- return rules;
- }
-
- if (rules === false) {
- return ['none'];
- }
-
- return undefined === rules ?
- ['local'] :
- rules.split(',');
-}
-
-module.exports = inlineOptionsFrom;
diff --git a/node_modules/clean-css/lib/options/optimization-level.js b/node_modules/clean-css/lib/options/optimization-level.js
deleted file mode 100644
index 0d3ad7303..000000000
--- a/node_modules/clean-css/lib/options/optimization-level.js
+++ /dev/null
@@ -1,221 +0,0 @@
-var roundingPrecisionFrom = require('./rounding-precision').roundingPrecisionFrom;
-
-var override = require('../utils/override');
-
-var OptimizationLevel = {
- Zero: '0',
- One: '1',
- Two: '2'
-};
-
-var DEFAULTS = {};
-
-DEFAULTS[OptimizationLevel.Zero] = {};
-DEFAULTS[OptimizationLevel.One] = {
- cleanupCharsets: true,
- normalizeUrls: true,
- optimizeBackground: true,
- optimizeBorderRadius: true,
- optimizeFilter: true,
- optimizeFontWeight: true,
- optimizeOutline: true,
- removeEmpty: true,
- removeNegativePaddings: true,
- removeQuotes: true,
- removeWhitespace: true,
- replaceMultipleZeros: true,
- replaceTimeUnits: true,
- replaceZeroUnits: true,
- roundingPrecision: roundingPrecisionFrom(undefined),
- selectorsSortingMethod: 'standard',
- specialComments: 'all',
- tidyAtRules: true,
- tidyBlockScopes: true,
- tidySelectors: true,
- transform: noop
-};
-DEFAULTS[OptimizationLevel.Two] = {
- mergeAdjacentRules: true,
- mergeIntoShorthands: true,
- mergeMedia: true,
- mergeNonAdjacentRules: true,
- mergeSemantically: false,
- overrideProperties: true,
- removeEmpty: true,
- reduceNonAdjacentRules: true,
- removeDuplicateFontRules: true,
- removeDuplicateMediaBlocks: true,
- removeDuplicateRules: true,
- removeUnusedAtRules: false,
- restructureRules: false,
- skipProperties: []
-};
-
-var ALL_KEYWORD_1 = '*';
-var ALL_KEYWORD_2 = 'all';
-var FALSE_KEYWORD_1 = 'false';
-var FALSE_KEYWORD_2 = 'off';
-var TRUE_KEYWORD_1 = 'true';
-var TRUE_KEYWORD_2 = 'on';
-
-var LIST_VALUE_SEPARATOR = ',';
-var OPTION_SEPARATOR = ';';
-var OPTION_VALUE_SEPARATOR = ':';
-
-function noop() {}
-
-function optimizationLevelFrom(source) {
- var level = override(DEFAULTS, {});
- var Zero = OptimizationLevel.Zero;
- var One = OptimizationLevel.One;
- var Two = OptimizationLevel.Two;
-
-
- if (undefined === source) {
- delete level[Two];
- return level;
- }
-
- if (typeof source == 'string') {
- source = parseInt(source);
- }
-
- if (typeof source == 'number' && source === parseInt(Two)) {
- return level;
- }
-
- if (typeof source == 'number' && source === parseInt(One)) {
- delete level[Two];
- return level;
- }
-
- if (typeof source == 'number' && source === parseInt(Zero)) {
- delete level[Two];
- delete level[One];
- return level;
- }
-
- if (typeof source == 'object') {
- source = covertValuesToHashes(source);
- }
-
- if (One in source && 'roundingPrecision' in source[One]) {
- source[One].roundingPrecision = roundingPrecisionFrom(source[One].roundingPrecision);
- }
-
- if (Two in source && 'skipProperties' in source[Two] && typeof(source[Two].skipProperties) == 'string') {
- source[Two].skipProperties = source[Two].skipProperties.split(LIST_VALUE_SEPARATOR);
- }
-
- if (Zero in source || One in source || Two in source) {
- level[Zero] = override(level[Zero], source[Zero]);
- }
-
- if (One in source && ALL_KEYWORD_1 in source[One]) {
- level[One] = override(level[One], defaults(One, normalizeValue(source[One][ALL_KEYWORD_1])));
- delete source[One][ALL_KEYWORD_1];
- }
-
- if (One in source && ALL_KEYWORD_2 in source[One]) {
- level[One] = override(level[One], defaults(One, normalizeValue(source[One][ALL_KEYWORD_2])));
- delete source[One][ALL_KEYWORD_2];
- }
-
- if (One in source || Two in source) {
- level[One] = override(level[One], source[One]);
- } else {
- delete level[One];
- }
-
- if (Two in source && ALL_KEYWORD_1 in source[Two]) {
- level[Two] = override(level[Two], defaults(Two, normalizeValue(source[Two][ALL_KEYWORD_1])));
- delete source[Two][ALL_KEYWORD_1];
- }
-
- if (Two in source && ALL_KEYWORD_2 in source[Two]) {
- level[Two] = override(level[Two], defaults(Two, normalizeValue(source[Two][ALL_KEYWORD_2])));
- delete source[Two][ALL_KEYWORD_2];
- }
-
- if (Two in source) {
- level[Two] = override(level[Two], source[Two]);
- } else {
- delete level[Two];
- }
-
- return level;
-}
-
-function defaults(level, value) {
- var options = override(DEFAULTS[level], {});
- var key;
-
- for (key in options) {
- if (typeof options[key] == 'boolean') {
- options[key] = value;
- }
- }
-
- return options;
-}
-
-function normalizeValue(value) {
- switch (value) {
- case FALSE_KEYWORD_1:
- case FALSE_KEYWORD_2:
- return false;
- case TRUE_KEYWORD_1:
- case TRUE_KEYWORD_2:
- return true;
- default:
- return value;
- }
-}
-
-function covertValuesToHashes(source) {
- var clonedSource = override(source, {});
- var level;
- var i;
-
- for (i = 0; i <= 2; i++) {
- level = '' + i;
-
- if (level in clonedSource && (clonedSource[level] === undefined || clonedSource[level] === false)) {
- delete clonedSource[level];
- }
-
- if (level in clonedSource && clonedSource[level] === true) {
- clonedSource[level] = {};
- }
-
- if (level in clonedSource && typeof clonedSource[level] == 'string') {
- clonedSource[level] = covertToHash(clonedSource[level], level);
- }
- }
-
- return clonedSource;
-}
-
-function covertToHash(asString, level) {
- return asString
- .split(OPTION_SEPARATOR)
- .reduce(function (accumulator, directive) {
- var parts = directive.split(OPTION_VALUE_SEPARATOR);
- var name = parts[0];
- var value = parts[1];
- var normalizedValue = normalizeValue(value);
-
- if (ALL_KEYWORD_1 == name || ALL_KEYWORD_2 == name) {
- accumulator = override(accumulator, defaults(level, normalizedValue));
- } else {
- accumulator[name] = normalizedValue;
- }
-
- return accumulator;
- }, {});
-}
-
-module.exports = {
- OptimizationLevel: OptimizationLevel,
- optimizationLevelFrom: optimizationLevelFrom,
-};
diff --git a/node_modules/clean-css/lib/options/rebase-to.js b/node_modules/clean-css/lib/options/rebase-to.js
deleted file mode 100644
index 134b4a382..000000000
--- a/node_modules/clean-css/lib/options/rebase-to.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var path = require('path');
-
-function rebaseToFrom(option) {
- return option ? path.resolve(option) : process.cwd();
-}
-
-module.exports = rebaseToFrom;
diff --git a/node_modules/clean-css/lib/options/rebase.js b/node_modules/clean-css/lib/options/rebase.js
deleted file mode 100644
index 999c83f50..000000000
--- a/node_modules/clean-css/lib/options/rebase.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function rebaseFrom(rebaseOption) {
- return undefined === rebaseOption ? true : !!rebaseOption;
-}
-
-module.exports = rebaseFrom;
diff --git a/node_modules/clean-css/lib/options/rounding-precision.js b/node_modules/clean-css/lib/options/rounding-precision.js
deleted file mode 100644
index 42ecf1b4d..000000000
--- a/node_modules/clean-css/lib/options/rounding-precision.js
+++ /dev/null
@@ -1,88 +0,0 @@
-var override = require('../utils/override');
-
-var INTEGER_PATTERN = /^\d+$/;
-
-var ALL_UNITS = ['*', 'all'];
-var DEFAULT_PRECISION = 'off'; // all precision changes are disabled
-var DIRECTIVES_SEPARATOR = ','; // e.g. *=5,px=3
-var DIRECTIVE_VALUE_SEPARATOR = '='; // e.g. *=5
-
-function roundingPrecisionFrom(source) {
- return override(defaults(DEFAULT_PRECISION), buildPrecisionFrom(source));
-}
-
-function defaults(value) {
- return {
- 'ch': value,
- 'cm': value,
- 'em': value,
- 'ex': value,
- 'in': value,
- 'mm': value,
- 'pc': value,
- 'pt': value,
- 'px': value,
- 'q': value,
- 'rem': value,
- 'vh': value,
- 'vmax': value,
- 'vmin': value,
- 'vw': value,
- '%': value
- };
-}
-
-function buildPrecisionFrom(source) {
- if (source === null || source === undefined) {
- return {};
- }
-
- if (typeof source == 'boolean') {
- return {};
- }
-
- if (typeof source == 'number' && source == -1) {
- return defaults(DEFAULT_PRECISION);
- }
-
- if (typeof source == 'number') {
- return defaults(source);
- }
-
- if (typeof source == 'string' && INTEGER_PATTERN.test(source)) {
- return defaults(parseInt(source));
- }
-
- if (typeof source == 'string' && source == DEFAULT_PRECISION) {
- return defaults(DEFAULT_PRECISION);
- }
-
- if (typeof source == 'object') {
- return source;
- }
-
- return source
- .split(DIRECTIVES_SEPARATOR)
- .reduce(function (accumulator, directive) {
- var directiveParts = directive.split(DIRECTIVE_VALUE_SEPARATOR);
- var name = directiveParts[0];
- var value = parseInt(directiveParts[1]);
-
- if (isNaN(value) || value == -1) {
- value = DEFAULT_PRECISION;
- }
-
- if (ALL_UNITS.indexOf(name) > -1) {
- accumulator = override(accumulator, defaults(value));
- } else {
- accumulator[name] = value;
- }
-
- return accumulator;
- }, {});
-}
-
-module.exports = {
- DEFAULT: DEFAULT_PRECISION,
- roundingPrecisionFrom: roundingPrecisionFrom
-};