Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peacefultruth/hashtag
use hashtags to navigate a code structure in javascript
https://github.com/peacefultruth/hashtag
hashtag hashtags javascript npm
Last synced: 8 days ago
JSON representation
use hashtags to navigate a code structure in javascript
- Host: GitHub
- URL: https://github.com/peacefultruth/hashtag
- Owner: peacefultruth
- License: mit
- Created: 2020-03-07T05:06:22.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-17T19:40:27.000Z (5 months ago)
- Last Synced: 2024-11-01T18:46:54.790Z (14 days ago)
- Topics: hashtag, hashtags, javascript, npm
- Language: JavaScript
- Homepage:
- Size: 166 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# hashtag
use hashtags to navigate a code structure.
```bash
yarn add @peacefultruth/hashtag
````##### interleave hashtags
```js
import {
hashtags,
} from "@peacefultruth/hashtag";expect(
hashtags(
"it ws a #nice and #sunny-day in #Berlin"
)
).toEqual(
["nice", "sunny_day", "Berlin"]
)````
##### use hashtags to navigate a code structure
```js
import { instruct } from "@peacefultruth/hashtag";
const degrees_celsius = 28;
expect(
instruct({
reference: {
sunny_day: {},
nice: {
sunny_day: ({ degrees_celsius }) => (
`${degrees_celsius} degrees celsius`
)
},
vitamind: previous_value => (
`${previous_value}.
I have had some sun for today.`
)
},
instructions: [
[
{
degrees_celsius
},
"it ws a #nice and #sunny-day in #Berlin"
],
["got some #vitamind"]
]
})
).toEqual(
`${degrees_celsius} degrees celsius.
I have had some sun for today.`
);
````##### match hashtag strings by scoring them
```js
import {
score_hashtags_match,
} from "@peacefultruth/hashtag";expect(
score_hashtags_match(
hashtags(
"it ws a #nice and #sunny-day in #Berlin"
),
hashtags(
"all the #nice #sunny days in #Berlin"
)
)
).toEqual(
3
);````