index.js
function processBreakpoints(root, breakpointsOption) {
  if (breakpointsOption && !Array.isArray(breakpointsOption)) {
    throw new Error('Breakpoints option must be of type Array.');
  }

  const defaultBreakpoints = [
    {
      prefix: 'xs-',
      mediaQuery: '(max-width: 40em)',
    },
    {
      prefix: 'sm-',
      mediaQuery: '(min-width: 40em)',
    },
    {
      prefix: 'md-',
      mediaQuery: '(min-width: 52em)',
    },
    {
      prefix: 'lg-',
      mediaQuery: '(min-width: 64em)',
    },
  ];

  const mergedBreakpoints = merge([], defaultBreakpoints, breakpointsOption);
  return mergedBreakpoints.map((breakpoint) => processBreakpoint(root, breakpoint));
}
function processBreakpoints(root, breakpointsOption) {
  if (breakpointsOption && !Array.isArray(breakpointsOption)) {
    throw new Error('Breakpoints option must be of type Array.');
  }

  const defaultBreakpoints = [
    {
      prefix: 'xs-',
      mediaQuery: '(max-width: 40em)',
    },
    {
      prefix: 'sm-',
      mediaQuery: '(min-width: 40em)',
    },
    {
      prefix: 'md-',
      mediaQuery: '(min-width: 52em)',
    },
    {
      prefix: 'lg-',
      mediaQuery: '(min-width: 64em)',
    },
  ];

  const mergedBreakpoints = merge([], defaultBreakpoints, breakpointsOption);
  return mergedBreakpoints.map((breakpoint) => processBreakpoint(root, breakpoint));
}
function processBreakpoints ( root , breakpointsOption ) { if ( breakpointsOption && ! Array . isArray ( breakpointsOption ) ) { throw new Error ( 'Breakpoints option must be of type Array.' ) ; } const defaultBreakpoints = [ { prefix : 'xs-' , mediaQuery : '(max-width: 40em)' , } , { prefix : 'sm-' , mediaQuery : '(min-width: 40em)' , } , { prefix : 'md-' , mediaQuery : '(min-width: 52em)' , } , { prefix : 'lg-' , mediaQuery : '(min-width: 64em)' , } , ] ; const mergedBreakpoints = merge ( [ ] , defaultBreakpoints , breakpointsOption ) ; return mergedBreakpoints . map ( ( breakpoint ) => processBreakpoint ( root , breakpoint ) ) ; }
Provides defaults for the breakpoints options and processes each one
@param {Object} root Root postcss node
@param {Array} breakpointsOption Array of breakpoint objects
@return {Array} Processed breakpoints option
Provides defaults for the breakpoints options and processes each one