Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@xdanangelxoqenpm/nobis-laborum-dolorum

xdanangelxoqenpm350MIT1.0.0

NPM

match, symbols, schema, sigterm, ECMAScript 2020, logging, Uint8Array, bundling, eventEmitter, emoji, toStringTag, option, Promise, buffers, toobject, prefix, arraybuffer, css variable, path, ratelimit, terminal, es-abstract, extra, performance, es-shims, fullwidth, ES3, view, AsyncIterator, api, sequence, runtime, ArrayBuffer#slice, Array.prototype.flatten, command, descriptors, libphonenumber, nope, ajv, stream, cli, efficient, jwt, redux, workspace:*, react pose, arktype, input, getPrototypeOf, ECMAScript 2023, superstruct, forEach, accessibility, enumerable, preprocessor, fixed-width, call-bind, launch, i18n, 3d, RegExp#flags, cjk, fast-copy, make, push, debugger, symlinks, eventDispatcher, dom, consume, http, signals, findLast, serializer, browserlist, censor, mocha, tools, exit, configurable, preserve-symlinks, Microsoft, superagent, internal, shared, ponyfill, jQuery, channel, typeerror, apollo, core-js, transpiler, read, user-streams, getOwnPropertyDescriptor, point-free, symbol, flag, es-shim API, eslint-plugin, every, multi-package, TypedArray, child, japanese, function, dependencies, settings, ansi, Float64Array, has, extend, mobile, xhr, YAML, irq, ES7, curried, language, styles, link, jsonschema, bound, config, rfc4122, es8, postcss, throttle, json, airbnb, circular, import, rmdir, variables in css, interrupts, Int32Array, rangeerror, positive, setImmediate, ECMAScript 7, less, native, authentication, symlink, installer, pyyaml, app, helpers, streams, watch, hardlinks, regexp, framework, bundler, install, bcrypt, performant, fastcopy, Array.prototype.flatMap, Array.prototype.includes, stateless, prop, ECMAScript 2016, sharedarraybuffer, set, contains, macos, lazy, css nesting, fastify, isConcatSpreadable, validator, shebang, events, stylesheet, find-up, ava, telephone, code points, js, argparse, less.js, mru, Uint8ClampedArray, toolkit, lesscss, spring, toSorted, lockfile, pipe, diff, matches, immer, ascii, WebSockets, entries, require, scheme, accessor, arrays, sham, sanitize, connect, description, callback, encryption, look-up, higher-order, Object.is, json-schema-validation, environment, name, open, private data, package manager, group, babel-core, Object.defineProperty, URLSearchParams, JSON-Schema, call-bound, folder, ES2016, starter, sameValueZero, opener, bind, autoprefixer, dataView, typesafe, URL, warning, spinner, random, typescript, uninstall, flatten, String.prototype.trim, String.prototype.matchAll, status, concat, art, which, id, testing, redact, rapid, regular expression, some, walk, characters, busy, progress, wget, start, monorepo, descriptor, exe, byteOffset, Object.getPrototypeOf, proto, idle, tc39, length, offset, properties, util.inspect, spinners, dom-testing-library, width, fsevents, ramda, es6, string, property, editor, optimist, shrinkwrap, Float32Array, ender, ts, whatwg, flat, lru, tester, styleguide, react, map, eslint, Array.prototype.flat, delete, jasmine, filter, ReactiveExtensions, setPrototypeOf, key, colour, vest, inference, buffer, full, ie, equal, korean, Symbol.toStringTag, functional, Int16Array, animation, datastructure, sigint, keys, weakmap, ecmascript, parser, json-schema-validator, javascript, expression, Object.assign, promise, jsdom, wordwrap, coercible, type, negative, speed, ES2017, estree, hasOwn, Observables, framer, groupBy, zod, crypt, findLastIndex, Stream, tacit, l10n, polyfill, es7, dataview, classes, nodejs, spec, slice, xss, regular expressions, persistent, class-validator, safe, clone, structuredClone, Array.prototype.contains, ES2023, date, stringifier, auth, RxJS, serialize, patch, form, qs, metadata, Array, validation, chinese, postcss-plugin, Object.keys, promises, web, mkdir, number, typed array, deep, react-testing-library, query, package.json, gestures, formatting, figlet, walking, debug, Array.prototype.findLastIndex, typed, BigInt64Array, inspect, prototype, Streams, ECMAScript 2021, defineProperty, Push, pose, ES2020, mime, json-schema, ECMAScript 6, react animation, jsdiff, io-ts, extension, awesomesauce, Array.prototype.filter, parents, querystring, call, xterm, flatMap, ECMAScript 2019, trimRight, compare, classname, file, mixins, Observable, linewrap, types, fetch, 256, getopt, ES2022, last, $.extend, weakset, ReactiveX, joi, ECMAScript 3, worker, express, styled-components, slot, default, streams2, ArrayBuffer, throat, typeof, collection.es6, website, names, WebSocket, traverse, remove, term, deep-copy, deepcopy, request, TypeBox, touch, equality, iteration, style, __proto__, CSSStyleDeclaration, password, WeakMap, chai, side, emit, deepclone, asserts, dir, 0, bootstrap css, search, @@toStringTag, up, variables, ES2021, utility, check, create, resolve, Array.prototype.findLast, argument, opens, generics, https, typedarray, column, quote, merge, StyleSheet, watching, tape, compiler, es2015, nested css, RegExp.prototype.flags, pnpm9, JSON, forms, batch, waapi, codes, Map, Object.entries, xdg, deep-clone, WeakSet, css-in-js, character, logger, negative zero, log, es5, values, duplex, ESnext, Reflect.getPrototypeOf, ECMAScript 2015, es2016, ECMAScript 2017, RFC-6455, 6to5, compile less, eslintconfig, syntax, .env, gdpr, banner, package, sanitization, copy, toArray, getter, css less, module, value, mkdirs, electron, shim, text, TypeScript, jest, command-line, minimal, console, Uint16Array, args, form-validation, const, dayjs, get, gradients css3, from, ast, scheme-validation, immutable, exit-code, readable, iterate, es, Uint32Array, invariant, linux, handlers, trimStart, glob, Set, browserslist, includes, typanion, matchAll, chrome, ECMAScript 2022, test, executable, take, fastclone, parent, collection, fast-clone, Iterator, move, concurrency, wrap, regular, react-hook-form, computed-types, is, Rx, write, hooks, ES2019, pure, assert, limited, yup, fantasy-land, [[Prototype]], reducer, find, optimizer, urls, less mixins, rgb, sorted, utilities, break, time, callbind, lint, phone, three, define, client, Object.fromEntries, setter, env, findup, modules, cors, mkdirp, ECMAScript 5, less css, cmd, once, curl, format, bootstrap less, mime-db, packages, stable, es2018, fs, fast-deep-copy, assertion, array, watchFile, rate, visual, byteLength, classnames, object, middleware, async, internal slot, escape, -0, yaml, trimLeft, unicode, syntaxerror, less compiler, babel, guid, jsx, commander, Object.values, harmony, spawn, look, intrinsic, drag, dependency manager, moment, protocol-buffers, ajax, wordbreak, await, react-hooks, deterministic, Symbol, dotenv, Function.prototype.name, plugin, data, reuse, fp, east-asian-width, serialization, robust, styling, task, listeners, tslib, hookform, ES2018, uuid, queueMicrotask, let, exec, Int8Array, getintrinsic, gradients css, make dir, error-handling, stringify, tdd, readablestream, util, file system, obj, utils, argv, directory, omit, ES2015, BigUint64Array, columns, valid, shell, error, hash, ES6, operating-system, arguments, real-time, writable, rm -fr, css, sort, redux-toolkit, HyBi, iterator, trim, chromium, crypto, mimetypes, pretty, colors, reduce, tap, xdg-open, tty, jsonpath, color, output, byte, node, loading, graphql, typedarrays, cache, trimEnd, karma, browser, prune, watcher, functions, callbound, parse, core, limit, windows, flags, fast, var, _.extend, bluebird, Object, popmotion, drop, assign, concatMap, regex, ES, ECMAScript 2018, rm, picomatch, ArrayBuffer.prototype.slice, eslintplugin, signal, protobuf, es2017, ES8, zero, process, ES5, queue, fast-deep-clone, npm, url, a11y, bdd, recursive, Underscore, indicator, tostringtag

readme

@xdanangelxoqenpm/nobis-laborum-dolorum

NPM

NPM version Bundlephobia minified + gzip build codecov NPM downloads

Parses CSS inline style to JavaScript object (camelCased):

StyleToJS(string)

Example

import parse from '@xdanangelxoqenpm/nobis-laborum-dolorum';

parse('background-color: #BADA55;');

Output:

{ "backgroundColor": "#BADA55" }

Replit | JSFiddle | Examples

Install

NPM:

npm install @xdanangelxoqenpm/nobis-laborum-dolorum --save

Yarn:

yarn add @xdanangelxoqenpm/nobis-laborum-dolorum

CDN:

<script src="https://unpkg.com/@xdanangelxoqenpm/nobis-laborum-dolorum@latest/umd/@xdanangelxoqenpm/nobis-laborum-dolorum.min.js"></script>
<script>
  window.StyleToJS(/* string */);
</script>

Usage

Import

Import with ES Modules:

import parse from '@xdanangelxoqenpm/nobis-laborum-dolorum';

Require with CommonJS:

const parse = require('@xdanangelxoqenpm/nobis-laborum-dolorum');

Parse style

Parse single declaration:

parse('line-height: 42');

Output:

{ "lineHeight": "42" }

Notice that the CSS property is camelCased.

Parse multiple declarations:

parse(`
  border-color: #ACE;
  z-index: 1337;
`);

Output:

{
  "borderColor": "#ACE",
  "zIndex": "1337"
}

Vendor prefix

Parse vendor prefix:

parse(`
  -webkit-transition: all 4s ease;
  -moz-transition: all 4s ease;
  -ms-transition: all 4s ease;
  -o-transition: all 4s ease;
  -khtml-transition: all 4s ease;
`);

Output:

{
  "webkitTransition": "all 4s ease",
  "mozTransition": "all 4s ease",
  "msTransition": "all 4s ease",
  "oTransition": "all 4s ease",
  "khtmlTransition": "all 4s ease"
}

Custom property

Parse custom property:

parse('--custom-property: #f00');

Output:

{ "--custom-property": "#f00" }

Unknown declaration

This library does not validate declarations, so unknown declarations can be parsed:

parse('the-answer: 42;');

Output:

{ "theAnswer": "42" }

Invalid declaration

Declarations with missing value are removed:

parse(`
  margin-top: ;
  margin-right: 1em;
`);

Output:

{ "marginRight": "1em" }

Other invalid declarations or arguments:

parse(); // {}
parse(null); // {}
parse(1); // {}
parse(true); // {}
parse('top:'); // {}
parse(':12px'); // {}
parse(':'); // {}
parse(';'); // {}

The following values will throw an error:

parse('top'); // Uncaught Error: property missing ':'
parse('/*'); // Uncaught Error: End of comment missing

Options

reactCompat

When option reactCompat is true, the vendor prefix will be capitalized:

parse(
  `
    -webkit-transition: all 4s ease;
    -moz-transition: all 4s ease;
    -ms-transition: all 4s ease;
    -o-transition: all 4s ease;
    -khtml-transition: all 4s ease;
  `,
  { reactCompat: true },
);

Output:

{
  "WebkitTransition": "all 4s ease",
  "MozTransition": "all 4s ease",
  "msTransition": "all 4s ease",
  "OTransition": "all 4s ease",
  "KhtmlTransition": "all 4s ease"
}

This removes the React warning:

Warning: Unsupported vendor-prefixed style property %s. Did you mean %s?%s", "oTransition", "OTransition"

Testing

Run tests with coverage:

npm test

Run tests in watch mode:

npm run test:watch

Lint files:

npm run lint

Fix lint errors:

npm run lint:fix

Release

Release and publish are automated by Release Please.

Special Thanks

License

MIT