Skip to content

Commit

Permalink
moved toClass shorthash dep to utils package
Browse files Browse the repository at this point in the history
  • Loading branch information
avigoldman committed Nov 10, 2017
1 parent 4ee891f commit bb12c57
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
5 changes: 0 additions & 5 deletions packages/heml-parse/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/heml-parse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"html-tags": "^2.0.0",
"lodash": "^4.17.4",
"postcss": "^6.0.14",
"postcss-safe-parser": "^3.0.1",
"shorthash": "0.0.2"
"postcss-safe-parser": "^3.0.1"
}
}
9 changes: 8 additions & 1 deletion packages/heml-utils/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/heml-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"dependencies": {
"@heml/render": "^1.0.2-0",
"css-groups": "^0.1.1",
"lodash": "^4.17.4"
"lodash": "^4.17.4",
"shorthash": "0.0.2"
}
}
3 changes: 2 additions & 1 deletion packages/heml-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ import createElement from './createElement'
import HEMLError from './HEMLError'
import transforms from './transforms'
import condition from './condition'
import toClass from './toClass'

module.exports = { createElement, renderElement, HEMLError, cssGroups, transforms, condition }
module.exports = { createElement, renderElement, HEMLError, cssGroups, transforms, condition, toClass }
10 changes: 10 additions & 0 deletions packages/heml-utils/src/toClass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { unique } from 'shorthash'

/**
* generates a consistent short class-safe hash from a longer string
* @param {String} str the string used in the hash function
* @return {String} the class
*/
export default function toClass(str) {
return `c${unique(s)}`
}

0 comments on commit bb12c57

Please sign in to comment.