Gathering detailed insights and metrics for inline-style-parser
Gathering detailed insights and metrics for inline-style-parser
Gathering detailed insights and metrics for inline-style-parser
Gathering detailed insights and metrics for inline-style-parser
yargs-parser
the mighty option parser used by yargs
fast-xml-parser
Validate XML, Parse XML, Build XML without C/C++ based libraries
@typescript-eslint/parser
An ESLint custom parser which leverages TypeScript ESTree
ua-parser-js
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client Hints data. Supports browser & node.js environment
npm install inline-style-parser
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
19 Stars
309 Commits
1 Forks
1 Watching
1 Branches
1 Contributors
Updated on 27 Nov 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-1.6%
1,390,594
Compared to previous day
Last week
4.3%
7,302,938
Compared to previous week
Last month
12.6%
30,525,488
Compared to previous month
Last year
13.2%
313,975,418
Compared to previous year
Inline style parser copied from css/lib/parse/index.js
:
InlineStyleParser(string)
Example:
1const parse = require('inline-style-parser'); 2 3parse('color: #BADA55;');
Output:
1[ { type: 'declaration', 2 property: 'color', 3 value: '#BADA55', 4 position: Position { start: [Object], end: [Object], source: undefined } } ]
NPM:
1npm install inline-style-parser --save
Yarn:
1yarn add inline-style-parser
CDN:
1<script src="https://unpkg.com/inline-style-parser@latest/dist/inline-style-parser.min.js"></script> 2<script> 3 window.InlineStyleParser(/* string */); 4</script>
Import with ES Modules:
1import parse from 'inline-style-parser';
Or require with CommonJS:
1const parse = require('inline-style-parser');
Parse single declaration:
1parse('left: 0');
Output:
1[ 2 { 3 type: 'declaration', 4 property: 'left', 5 value: '0', 6 position: { 7 start: { line: 1, column: 1 }, 8 end: { line: 1, column: 8 }, 9 source: undefined 10 } 11 } 12]
Parse multiple declarations:
1parse('left: 0; right: 100px;');
Output:
1[ 2 { 3 type: 'declaration', 4 property: 'left', 5 value: '0', 6 position: { 7 start: { line: 1, column: 1 }, 8 end: { line: 1, column: 8 }, 9 source: undefined 10 } 11 }, 12 { 13 type: 'declaration', 14 property: 'right', 15 value: '100px', 16 position: { 17 start: { line: 1, column: 10 }, 18 end: { line: 1, column: 22 }, 19 source: undefined 20 } 21 } 22]
Parse declaration with missing value:
1parse('top:');
Output:
1[ 2 { 3 type: 'declaration', 4 property: 'top', 5 value: '', 6 position: { 7 start: { line: 1, column: 1 }, 8 end: { line: 1, column: 5 }, 9 source: undefined 10 } 11 } 12]
Parse unknown declaration:
1parse('answer: 42;');
Output:
1[ 2 { 3 type: 'declaration', 4 property: 'answer', 5 value: '42', 6 position: { 7 start: { line: 1, column: 1 }, 8 end: { line: 1, column: 11 }, 9 source: undefined 10 } 11 } 12]
Invalid declarations:
1parse(''); // [] 2parse(); // throws TypeError 3parse(1); // throws TypeError 4parse('width'); // throws Error 5parse('/*'); // throws Error
Run tests:
1npm test
Run tests in watch mode:
1npm run test:watch
Run tests with coverage:
1npm run test:coverage
Run tests in CI mode:
1npm run test:ci
Lint files:
1npm run lint
Fix lint errors:
1npm run lint:fix
Release and publish are automated by Release Please.
No vulnerabilities found.
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
SAST tool is run on all commits
Details
Reason
0 existing vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More