@landmineaknpm2/temporibus-amet-exercitationem

1.0.0 • Public • Published

@landmineaknpm2/temporibus-amet-exercitationem

Build status NPM version js-xo-style

Unnest/flatten a Unistyle Object to a structure which resembles real CSS

Installation

Install @landmineaknpm2/temporibus-amet-exercitationem using npm:

npm install --save @landmineaknpm2/temporibus-amet-exercitationem

Usage

Module usage

Nesting

var flat = require('@landmineaknpm2/temporibus-amet-exercitationem');

flat({
	a: {
		':hover': {
			fontWeight: 'bold'
		}
	}
});
/**
 * {
 *   'a:hover': {
 *     fontWeight: 'bold'
 *   }
 * }
 */

References

var flat = require('@landmineaknpm2/temporibus-amet-exercitationem');

flat({
	a: {
		'& + span': {
			fontWeight: 'bold'
		}
	}
});
/**
 * {
 *   'a + span': {
 *     fontWeight: 'bold'
 *   }
 * }
 */

Media Queries

var flat = require('@landmineaknpm2/temporibus-amet-exercitationem');

flat({
	p: {
		fontSize: '1em',
		'@media only screen and (max-width: 700px)': {
			fontSize: '.8em'
		}
	}
});
/**
 * {
 *   p: {
 *     fontSize: '1em'
 *   },
 *   '@media only screen and (max-width: 700px)': {
 *     p: {
 *       fontSize: '.8em'
 *     }
 *   }
 * }
 */

Arrays

var flat = require('@landmineaknpm2/temporibus-amet-exercitationem');

flat([
	{body: {color: 'white'}},
	{body: {background: 'blue'}}
]);
/**
 * {
 *   body: {
 *     color: 'white',
 *     background: 'blue'
 *   }
 * }
 */

Grouping of selectors

var flat = require('@landmineaknpm2/temporibus-amet-exercitationem');

flat({
	'.item1': {color: 'white'},
	'.item2': {color: 'white', background: 'blue'}
});
/**
 * {
 *   '.item1, .item2': {
 *     color: 'white'
 *   },
 *   '.item2': {
 *     background: 'blue'
 *   }
 * }
 */

API

flat(obj)

Name Type Description
obj `Object Array`

Returns: Object, the flattened/unnested object.

License

MIT © Joakim Carlstein

Readme

Keywords

Package Sidebar

Install

npm i @landmineaknpm2/temporibus-amet-exercitationem

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

17.3 kB

Total Files

8

Last publish

Collaborators

  • hai836799