Skip to content

Commit 978b731

Browse files
author
Mahir Shah
committed
2 parents 2b3d140 + f8cb105 commit 978b731

File tree

3 files changed

+36
-21
lines changed

3 files changed

+36
-21
lines changed

.eslintrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"env": {
66
"node": true
77
},
8-
"extends": "airbnb",
8+
"extends": "airbnb/base",
99
"rules": {
1010
"max-len": [
1111
"error",
@@ -35,4 +35,4 @@
3535
"global-require": "off",
3636
"valid-jsdoc": "error"
3737
}
38-
}
38+
}

css-property-parser.d.ts

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,51 @@ declare namespace CssPropertyParser {
66
}
77

88
/**
9-
* Given a property and value attempts to expand the value into its longhand equivalents. Returns an object
10-
* mapping the property longhand names to the longhand values. If the property cannot be expanded (i.e. the property
11-
* is not a shorthand property) simply returns an object mapping the original property to the original value.
9+
* Given a property and value attempts to expand the value into its longhand
10+
* equivalents. Returns an object mapping the property longhand names to the
11+
* longhand values. If the property cannot be expanded (i.e. the property is
12+
* not a shorthand property) simply returns an object mapping the original
13+
* property to the original value.
1214
*
1315
* @param {string} propertyName - the property name for the given value
1416
* @param {string} propertyValue - the value of the property
15-
* @param {boolean} [recursivelyResolve=true] - recursively resolve additional longhand properties if the shorthands
16-
* expand to additional shorthands. For example, the border property
17-
* expands to border-width, which expands further to border-left-width,
18-
* border-right-width, etc.
17+
* @param {boolean} [recursivelyResolve=true] - recursively resolve additional
18+
* longhand properties if the shorthands expand to additional shorthands. For
19+
* example, the border property expands to border-width, which expands
20+
* further to border-left-width, border-right-width, etc.
21+
* @param {boolean} [includeInitialValues=false] - when expanding the shorthand
22+
* property, fill in any missing longhand values with their initial value.
23+
* For example, the property declaration "border: 1px" only explicitly sets the
24+
* "border-width" longhand property. If this param is true, the returned object
25+
* will fill in the initial values for "border-style" and "border-color". By
26+
* default, the returned object will only contain the "border-width".
1927
*/
2028
function expandShorthandProperty(
2129
propertyName: string,
2230
propertyValue: string,
23-
recursivelyResolve?: boolean
31+
recursivelyResolve?: boolean,
32+
includeInitialValues?: boolean,
2433
): Declarations;
2534

2635
/**
27-
* Given a shorthand property, returns an array of the computed properties for that shorthand property. If given
28-
* a known property that is not a shorthand, simply returns the given property. If given an unknown property,
29-
* returns an empty array.
36+
* Given a shorthand property, returns an array of the computed properties for
37+
* that shorthand property. If given a known property that is not a shorthand,
38+
* simply returns the given property. If given an unknown property, returns an
39+
* empty array.
3040
*
31-
* @param {string} shorthandProperty - the shorthand property name. For example, "background" or "border".
32-
* @returns {Array} - an array containing the computed properties for the given shorthand property. Returns an
33-
* empty array if the given property is not a valid property.
41+
* @param {string} shorthandProperty - the shorthand property name. For
42+
* example, "background" or "border".
43+
* @param {boolean} recursivelyResolve - recursively resolve additional
44+
* longhand properties if the shorthands expand to additional shorthands. For
45+
* example, the border property expands to border-width, which expands further
46+
* to border-left-width, border-right-width, etc.
47+
* @returns {Array} - an array containing the computed properties for the given
48+
* shorthand property. Returns an empty array if the given property is not a
49+
* valid property.
3450
*/
3551
function getShorthandComputedProperties(
36-
shorthandProperty: string
52+
shorthandProperty: string,
53+
recursivelyResolve: boolean
3754
): Array<string>;
3855

3956
/**
@@ -57,4 +74,4 @@ declare namespace CssPropertyParser {
5774
value: string
5875
): boolean;
5976

60-
}
77+
}

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "css-property-parser",
3-
"version": "1.0.0",
3+
"version": "0.1.0",
44
"description": "Validate css properties and expand shorthand css properties",
55
"main": "src/index.js",
66
"scripts": {
@@ -25,8 +25,6 @@
2525
"eslint": "^3.19.0",
2626
"eslint-config-airbnb": "^15.1.0",
2727
"eslint-plugin-import": "^2.7.0",
28-
"eslint-plugin-jsx-a11y": "^5.1.1",
29-
"eslint-plugin-react": "^7.2.1",
3028
"microtime": "^2.1.6",
3129
"mocha": "^3.5.0",
3230
"pre-commit": "^1.2.2",

0 commit comments

Comments
 (0)