New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

transform-parser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

transform-parser

Converts css transform string to an object and vice versa

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
65
decreased by-72.1%
Maintainers
1
Weekly downloads
 
Created
Source

Transform Parser

A small utility which converts css transform string to an object and vice versa.

Install

npm i transform-parser

# or

yarn add transform-parser

You can also addtransform-parser directly to your webpage and use it. The package will be available under window.transform.

<script src="https://unpkg.com/transform-parser"></script>

Usage

Like React, the default unit is px(pixel). When a number is passed as value, it will be suffixed with px and vice verse. Of course, the substitution will be skipped for transforms which requires numeral values, like scale3d().

import { parse, stringify } from 'transform-parser';
const transformString =
	'translate3d(10px, 40px, 24px) scale3d(1.1, 1.1, 1.1) perspective(20px)';

parse(transformString);
// => {translate3d: [10, 40, 24], scale3d(1.1, 1.1, 1.1), perspective: 20}

const transformObject = {
	rotate3d: [1, 2.0, 3.0, '10deg'],
	scale3d: [1.1, 1.1, 1.1],
	skewX: '30deg',
};

stringify(transformObject);
// => 'rotate3d(1, 2.0, 3.0, 10deg) scale3d(1.1, 1.1, 1.1) skewX(30deg)'

Local Development

yarn install
yarn build
yarn test

License

MIT

FAQs

Package last updated on 28 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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