WIP - add extractor, generate snippet_data
This commit is contained in:
23
node_modules/state-toggle/index.js
generated
vendored
Normal file
23
node_modules/state-toggle/index.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = factory
|
||||
|
||||
// Construct a state `toggler`: a function which inverses `property` in context
|
||||
// based on its current value.
|
||||
// The by `toggler` returned function restores that value.
|
||||
function factory(key, state, ctx) {
|
||||
return enter
|
||||
|
||||
function enter() {
|
||||
var context = ctx || this
|
||||
var current = context[key]
|
||||
|
||||
context[key] = !state
|
||||
|
||||
return exit
|
||||
|
||||
function exit() {
|
||||
context[key] = current
|
||||
}
|
||||
}
|
||||
}
|
||||
22
node_modules/state-toggle/license
generated
vendored
Normal file
22
node_modules/state-toggle/license
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
107
node_modules/state-toggle/package.json
generated
vendored
Normal file
107
node_modules/state-toggle/package.json
generated
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
{
|
||||
"_from": "state-toggle@^1.0.0",
|
||||
"_id": "state-toggle@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-8LpelPGR0qQM4PnfLiplOQNJcIN1/r2Gy0xKB2zKnIW2YzPMt2sR4I/+gtPjhN7Svh9kw+zqEg2SFwpBO9iNiw==",
|
||||
"_location": "/state-toggle",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "state-toggle@^1.0.0",
|
||||
"name": "state-toggle",
|
||||
"escapedName": "state-toggle",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/remark-parse",
|
||||
"/remark-stringify",
|
||||
"/remark/remark-stringify"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.2.tgz",
|
||||
"_shasum": "75e93a61944116b4959d665c8db2d243631d6ddc",
|
||||
"_spec": "state-toggle@^1.0.0",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/remark-parse",
|
||||
"author": {
|
||||
"name": "Titus Wormer",
|
||||
"email": "tituswormer@gmail.com",
|
||||
"url": "https://wooorm.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/wooorm/state-toggle/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Titus Wormer",
|
||||
"email": "tituswormer@gmail.com",
|
||||
"url": "https://wooorm.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Enter/exit a state",
|
||||
"devDependencies": {
|
||||
"browserify": "^16.0.0",
|
||||
"nyc": "^14.0.0",
|
||||
"prettier": "^1.12.1",
|
||||
"remark-cli": "^6.0.0",
|
||||
"remark-preset-wooorm": "^4.0.0",
|
||||
"tape": "^4.0.0",
|
||||
"tinyify": "^2.5.0",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/wooorm/state-toggle#readme",
|
||||
"keywords": [
|
||||
"enter",
|
||||
"exit",
|
||||
"state"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "state-toggle",
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/wooorm/state-toggle.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"build-bundle": "browserify . -s stateToggle -o state-toggle.js",
|
||||
"build-mangle": "browserify . -s stateToggle -p tinyify -o state-toggle.min.js",
|
||||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
|
||||
"test": "npm run format && npm run build && npm run test-coverage",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js"
|
||||
},
|
||||
"version": "1.0.2",
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"ignores": [
|
||||
"state-toggle.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
95
node_modules/state-toggle/readme.md
generated
vendored
Normal file
95
node_modules/state-toggle/readme.md
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
# state-toggle
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
|
||||
Enter/exit a state.
|
||||
|
||||
## Installation
|
||||
|
||||
[npm][]:
|
||||
|
||||
```bash
|
||||
npm install state-toggle
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var toggle = require('state-toggle')
|
||||
|
||||
var ctx = {on: false}
|
||||
var enter = toggle('on', ctx.on, ctx)
|
||||
var exit
|
||||
|
||||
// Entering:
|
||||
exit = enter()
|
||||
console.log(ctx.on) // => true
|
||||
|
||||
// Exiting:
|
||||
exit()
|
||||
console.log(ctx.on) // => false
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `toggle(key, initial[, ctx])`
|
||||
|
||||
Create a toggle, which when entering toggles `key` on `ctx` (or `this`,
|
||||
if `ctx` is not given) to `!initial`, and when exiting, sets `key` on
|
||||
the context back to the value it had before entering.
|
||||
|
||||
###### Returns
|
||||
|
||||
`Function` — [`enter`][enter].
|
||||
|
||||
### `enter()`
|
||||
|
||||
Enter the state.
|
||||
|
||||
###### Context
|
||||
|
||||
If no `ctx` was given to `toggle`, the context object (`this`) of `enter()`
|
||||
is used to toggle.
|
||||
|
||||
###### Returns
|
||||
|
||||
`Function` — [`exit`][exit].
|
||||
|
||||
### `exit()`
|
||||
|
||||
Exit the state, reverting `key` to the value it had before entering.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://img.shields.io/travis/wooorm/state-toggle.svg
|
||||
|
||||
[build]: https://travis-ci.org/wooorm/state-toggle
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/state-toggle.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/wooorm/state-toggle
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/state-toggle.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/state-toggle
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/state-toggle.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=state-toggle
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[enter]: #enter
|
||||
|
||||
[exit]: #exit
|
||||
Reference in New Issue
Block a user