poe-code 12.0.11 → 13.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -3
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/node_modules/esprima/LICENSE.BSD +21 -0
- package/node_modules/esprima/README.md +46 -0
- package/node_modules/esprima/bin/esparse.js +139 -0
- package/node_modules/esprima/bin/esvalidate.js +236 -0
- package/node_modules/esprima/dist/esprima.js +6709 -0
- package/node_modules/esprima/package.json +112 -0
- package/node_modules/extend-shallow/LICENSE +21 -0
- package/node_modules/extend-shallow/README.md +61 -0
- package/node_modules/extend-shallow/index.js +33 -0
- package/node_modules/extend-shallow/package.json +56 -0
- package/node_modules/gray-matter/LICENSE +21 -0
- package/node_modules/gray-matter/README.md +565 -0
- package/node_modules/gray-matter/gray-matter.d.ts +114 -0
- package/node_modules/gray-matter/index.js +228 -0
- package/node_modules/gray-matter/lib/defaults.js +18 -0
- package/node_modules/gray-matter/lib/engine.js +30 -0
- package/node_modules/gray-matter/lib/engines.js +54 -0
- package/node_modules/gray-matter/lib/excerpt.js +32 -0
- package/node_modules/gray-matter/lib/parse.js +13 -0
- package/node_modules/gray-matter/lib/stringify.js +56 -0
- package/node_modules/gray-matter/lib/to-file.js +43 -0
- package/node_modules/gray-matter/lib/utils.js +66 -0
- package/node_modules/gray-matter/node_modules/argparse/LICENSE +21 -0
- package/node_modules/gray-matter/node_modules/argparse/README.md +257 -0
- package/node_modules/gray-matter/node_modules/argparse/index.js +3 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/append/constant.js +47 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/append.js +53 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/count.js +40 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/help.js +47 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/store/constant.js +43 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/store/false.js +27 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/store/true.js +26 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/store.js +50 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/subparsers.js +149 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/version.js +47 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action.js +146 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action_container.js +482 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/argparse.js +14 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/argument/error.js +50 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/argument/exclusive.js +54 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/argument/group.js +75 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/argument_parser.js +1161 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/const.js +21 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/help/added_formatters.js +87 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/help/formatter.js +795 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/namespace.js +76 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/utils.js +57 -0
- package/node_modules/gray-matter/node_modules/argparse/package.json +34 -0
- package/node_modules/gray-matter/node_modules/js-yaml/LICENSE +21 -0
- package/node_modules/gray-matter/node_modules/js-yaml/README.md +302 -0
- package/node_modules/gray-matter/node_modules/js-yaml/bin/js-yaml.js +132 -0
- package/node_modules/gray-matter/node_modules/js-yaml/dist/js-yaml.js +4011 -0
- package/node_modules/gray-matter/node_modules/js-yaml/dist/js-yaml.min.js +1 -0
- package/node_modules/gray-matter/node_modules/js-yaml/index.js +7 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/common.js +59 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/dumper.js +850 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/exception.js +43 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/loader.js +1666 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/mark.js +76 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema.js +108 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/binary.js +138 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js +35 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/float.js +116 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/int.js +173 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/function.js +93 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +60 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +28 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/null.js +34 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/omap.js +44 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/pairs.js +53 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/set.js +29 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +88 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml.js +39 -0
- package/node_modules/gray-matter/node_modules/js-yaml/package.json +52 -0
- package/node_modules/gray-matter/package.json +127 -0
- package/node_modules/is-extendable/LICENSE +21 -0
- package/node_modules/is-extendable/README.md +72 -0
- package/node_modules/is-extendable/index.js +13 -0
- package/node_modules/is-extendable/package.json +51 -0
- package/node_modules/kind-of/LICENSE +21 -0
- package/node_modules/kind-of/README.md +367 -0
- package/node_modules/kind-of/index.js +129 -0
- package/node_modules/kind-of/package.json +88 -0
- package/node_modules/section-matter/LICENSE +21 -0
- package/node_modules/section-matter/README.md +236 -0
- package/node_modules/section-matter/index.js +136 -0
- package/node_modules/section-matter/package.json +55 -0
- package/node_modules/sprintf-js/.npmignore +1 -0
- package/node_modules/sprintf-js/LICENSE +24 -0
- package/node_modules/sprintf-js/README.md +88 -0
- package/node_modules/sprintf-js/bower.json +14 -0
- package/node_modules/sprintf-js/demo/angular.html +20 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js +4 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +1 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.map +1 -0
- package/node_modules/sprintf-js/dist/sprintf.min.js +4 -0
- package/node_modules/sprintf-js/dist/sprintf.min.js.map +1 -0
- package/node_modules/sprintf-js/dist/sprintf.min.map +1 -0
- package/node_modules/sprintf-js/gruntfile.js +36 -0
- package/node_modules/sprintf-js/package.json +22 -0
- package/node_modules/sprintf-js/src/angular-sprintf.js +18 -0
- package/node_modules/sprintf-js/src/sprintf.js +208 -0
- package/node_modules/sprintf-js/test/test.js +82 -0
- package/node_modules/strip-bom-string/LICENSE +21 -0
- package/node_modules/strip-bom-string/README.md +66 -0
- package/node_modules/strip-bom-string/index.js +15 -0
- package/node_modules/strip-bom-string/package.json +60 -0
- package/package.json +6 -3
- package/packages/safe-fs/dist/fs/webdav/webdav.d.ts +2 -0
- package/packages/safe-js/dist/browser/chunks/{chunk-MUKMA7ZY.js → chunk-GJWMQ42Z.js} +35 -2
- package/packages/safe-js/dist/browser/chunks/{chunk-MUKMA7ZY.js.map → chunk-GJWMQ42Z.js.map} +2 -2
- package/packages/safe-js/dist/browser/safe-fs-core.js +1 -1
- package/packages/safe-js/dist/browser/safe-fs.js +1 -1
- package/packages/safe-js/dist/chunks/{chunk-HCODJUGF.js → chunk-EL23VF23.js} +3 -3
- package/packages/safe-js/dist/chunks/{chunk-YBQUQPZV.js → chunk-WVN5MMDR.js} +35 -2
- package/packages/safe-js/dist/chunks/chunk-WVN5MMDR.js.map +7 -0
- package/packages/safe-js/dist/chunks/{chunk-F7NY24BF.js → chunk-ZRX5HT5L.js} +2 -2
- package/packages/safe-js/dist/cli.js +3 -3
- package/packages/safe-js/dist/index.js +3 -3
- package/packages/safe-js/dist/safe-fs-core.js +1 -1
- package/packages/safe-js/dist/safe-fs-node.js +2 -2
- package/packages/safe-js/dist/safe-fs.js +2 -2
- package/packages/safe-js/dist/chunks/chunk-YBQUQPZV.js.map +0 -7
- /package/packages/safe-js/dist/chunks/{chunk-HCODJUGF.js.map → chunk-EL23VF23.js.map} +0 -0
- /package/packages/safe-js/dist/chunks/{chunk-F7NY24BF.js.map → chunk-ZRX5HT5L.js.map} +0 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# section-matter [](https://www.npmjs.com/package/section-matter) [](https://npmjs.org/package/section-matter) [](https://npmjs.org/package/section-matter) [](https://travis-ci.org/jonschlinkert/section-matter)
|
|
2
|
+
|
|
3
|
+
> Like front-matter, but supports multiple sections in a document.
|
|
4
|
+
|
|
5
|
+
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
Install with [npm](https://www.npmjs.com/):
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
$ npm install --save section-matter
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
**Params**
|
|
17
|
+
|
|
18
|
+
* `input` **{String|Buffer|Object}**: If input is an object, it's `content` property must be a string or buffer.
|
|
19
|
+
* **{Object}**: options
|
|
20
|
+
* `returns` **{Object}**: Returns an object with a `content` string and an array of `sections` objects.
|
|
21
|
+
|
|
22
|
+
**Example**
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
var sections = require('{%= name %}');
|
|
26
|
+
var result = sections(input, options);
|
|
27
|
+
// { content: 'Content before sections', sections: [] }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
See available [options](#options).
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
|
|
34
|
+
_With the exception of front-matter, **which must be the very first thing in the string**, the opening delimiter of all other sections must be followed by a string to be used as the `key` for the section._
|
|
35
|
+
|
|
36
|
+
Given the following string:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Content before the sections.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
More content.
|
|
44
|
+
|
|
45
|
+
---one
|
|
46
|
+
title: One
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
This is the first section.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The following code:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
console.log(sections(input));
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Results in:
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
{
|
|
62
|
+
content: 'Content before the sections.\n\n---\n\nMore content.\n',
|
|
63
|
+
sections: [
|
|
64
|
+
{
|
|
65
|
+
key: 'one',
|
|
66
|
+
data: 'title: One',
|
|
67
|
+
content: '\nThis is the first section.'
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Options
|
|
74
|
+
|
|
75
|
+
### options.section_parse
|
|
76
|
+
|
|
77
|
+
**Type**: `function`
|
|
78
|
+
|
|
79
|
+
**Default**: `undefined`
|
|
80
|
+
|
|
81
|
+
Function to be called on each section after it's parsed from the string.
|
|
82
|
+
|
|
83
|
+
**Example**
|
|
84
|
+
|
|
85
|
+
Given the following string (`foo.md`):
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
This is content before the sections.
|
|
89
|
+
|
|
90
|
+
---one
|
|
91
|
+
title: First section
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
This is section one.
|
|
95
|
+
|
|
96
|
+
---two
|
|
97
|
+
title: Second section
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
This is section two.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Using the following custom `section_parse` function:
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
var fs = require('fs');
|
|
107
|
+
var path = require('path');
|
|
108
|
+
var yaml = require('js-yaml');
|
|
109
|
+
var sections = require('section-matter');
|
|
110
|
+
|
|
111
|
+
var str = fs.readFileSync('foo.md');
|
|
112
|
+
var options = {
|
|
113
|
+
section_parse: function(section) {
|
|
114
|
+
console.log(section)
|
|
115
|
+
section.key = 'section-' + section.key;
|
|
116
|
+
section.data = yaml.safeLoad(section.data);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
var result = sections(str, options);
|
|
121
|
+
console.log(result);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Results in:
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
{
|
|
128
|
+
content: 'This is content before the sections.\n',
|
|
129
|
+
sections: [
|
|
130
|
+
{
|
|
131
|
+
key: 'section-one',
|
|
132
|
+
data: { title: 'First section' },
|
|
133
|
+
content: '\nThis is section one.\n'
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
key: 'section-two',
|
|
137
|
+
data: { title: 'Second section' },
|
|
138
|
+
content: '\nThis is section two.\n'
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### options.section_delimiter
|
|
145
|
+
|
|
146
|
+
**Type**: `string`
|
|
147
|
+
|
|
148
|
+
**Default**: `---`
|
|
149
|
+
|
|
150
|
+
Delimiter to use as the separator for sections. _With the exception of front-matter, which must be the very first thing in the string, the opening delimiter of all other sections must be followed by a string to be used as the `key` for the section._
|
|
151
|
+
|
|
152
|
+
**Example**
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
var input = '~~~\ntitle: bar\n~~~\n\nfoo\n~~~one\ntitle: One\n~~~\nThis is one';
|
|
156
|
+
console.log(sections(input, {section_delimiter: '~~~'}));
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Results in:
|
|
160
|
+
|
|
161
|
+
```js
|
|
162
|
+
{
|
|
163
|
+
content: '',
|
|
164
|
+
sections: [
|
|
165
|
+
{
|
|
166
|
+
key: '',
|
|
167
|
+
data: 'title: bar',
|
|
168
|
+
content: '\nfoo'
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
key: 'one',
|
|
172
|
+
data: 'title: One',
|
|
173
|
+
content: 'This is one'
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## About
|
|
180
|
+
<details>
|
|
181
|
+
<summary><strong>Contributing</strong></summary>
|
|
182
|
+
|
|
183
|
+
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
|
184
|
+
|
|
185
|
+
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
|
|
186
|
+
|
|
187
|
+
</details>
|
|
188
|
+
|
|
189
|
+
<details>
|
|
190
|
+
<summary><strong>Running Tests</strong></summary>
|
|
191
|
+
|
|
192
|
+
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
|
193
|
+
|
|
194
|
+
```sh
|
|
195
|
+
$ npm install && npm test
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
</details>
|
|
199
|
+
|
|
200
|
+
<details>
|
|
201
|
+
<summary><strong>Building docs</strong></summary>
|
|
202
|
+
|
|
203
|
+
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
|
204
|
+
|
|
205
|
+
To generate the readme, run the following command:
|
|
206
|
+
|
|
207
|
+
```sh
|
|
208
|
+
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
</details>
|
|
212
|
+
|
|
213
|
+
### Related projects
|
|
214
|
+
|
|
215
|
+
You might also be interested in these projects:
|
|
216
|
+
|
|
217
|
+
- [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
|
|
218
|
+
- [gray-matter](https://www.npmjs.com/package/gray-matter): Parse front-matter from a string or file. Fast, reliable and easy to use. Parses YAML… [more](https://github.com/jonschlinkert/gray-matter) | [homepage](https://github.com/jonschlinkert/gray-matter "Parse front-matter from a string or file. Fast, reliable and easy to use. Parses YAML front matter by default, but also has support for YAML, JSON, TOML or Coffee Front-Matter, with options to set custom delimiters. Used by metalsmith, assemble, verb and ")
|
|
219
|
+
- [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.")
|
|
220
|
+
|
|
221
|
+
### Contributors
|
|
222
|
+
|
|
223
|
+
### Author
|
|
224
|
+
**Jon Schlinkert**
|
|
225
|
+
|
|
226
|
+
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
|
227
|
+
+ [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
|
228
|
+
|
|
229
|
+
### License
|
|
230
|
+
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
|
231
|
+
Released under the [MIT License](LICENSE).
|
|
232
|
+
|
|
233
|
+
***
|
|
234
|
+
|
|
235
|
+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 23, 2017._
|
|
236
|
+
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var typeOf = require('kind-of');
|
|
4
|
+
var extend = require('extend-shallow');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Parse sections in `input` with the given `options`.
|
|
8
|
+
*
|
|
9
|
+
* ```js
|
|
10
|
+
* var sections = require('{%= name %}');
|
|
11
|
+
* var result = sections(input, options);
|
|
12
|
+
* // { content: 'Content before sections', sections: [] }
|
|
13
|
+
* ```
|
|
14
|
+
* @param {String|Buffer|Object} `input` If input is an object, it's `content` property must be a string or buffer.
|
|
15
|
+
* @param {Object} options
|
|
16
|
+
* @return {Object} Returns an object with a `content` string and an array of `sections` objects.
|
|
17
|
+
* @api public
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
module.exports = function(input, options) {
|
|
21
|
+
if (typeof options === 'function') {
|
|
22
|
+
options = { parse: options };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var file = toObject(input);
|
|
26
|
+
var defaults = {section_delimiter: '---', parse: identity};
|
|
27
|
+
var opts = extend({}, defaults, options);
|
|
28
|
+
var delim = opts.section_delimiter;
|
|
29
|
+
var lines = file.content.split(/\r?\n/);
|
|
30
|
+
var sections = null;
|
|
31
|
+
var section = createSection();
|
|
32
|
+
var content = [];
|
|
33
|
+
var stack = [];
|
|
34
|
+
|
|
35
|
+
function initSections(val) {
|
|
36
|
+
file.content = val;
|
|
37
|
+
sections = [];
|
|
38
|
+
content = [];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function closeSection(val) {
|
|
42
|
+
if (stack.length) {
|
|
43
|
+
section.key = getKey(stack[0], delim);
|
|
44
|
+
section.content = val;
|
|
45
|
+
opts.parse(section, sections);
|
|
46
|
+
sections.push(section);
|
|
47
|
+
section = createSection();
|
|
48
|
+
content = [];
|
|
49
|
+
stack = [];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
for (var i = 0; i < lines.length; i++) {
|
|
54
|
+
var line = lines[i];
|
|
55
|
+
var len = stack.length;
|
|
56
|
+
var ln = line.trim();
|
|
57
|
+
|
|
58
|
+
if (isDelimiter(ln, delim)) {
|
|
59
|
+
if (ln.length === 3 && i !== 0) {
|
|
60
|
+
if (len === 0 || len === 2) {
|
|
61
|
+
content.push(line);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
stack.push(ln);
|
|
65
|
+
section.data = content.join('\n');
|
|
66
|
+
content = [];
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (sections === null) {
|
|
71
|
+
initSections(content.join('\n'));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (len === 2) {
|
|
75
|
+
closeSection(content.join('\n'));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
stack.push(ln);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
content.push(line);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (sections === null) {
|
|
86
|
+
initSections(content.join('\n'));
|
|
87
|
+
} else {
|
|
88
|
+
closeSection(content.join('\n'));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
file.sections = sections;
|
|
92
|
+
return file;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
function isDelimiter(line, delim) {
|
|
96
|
+
if (line.slice(0, delim.length) !== delim) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
if (line.charAt(delim.length + 1) === delim.slice(-1)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function toObject(input) {
|
|
106
|
+
if (typeOf(input) !== 'object') {
|
|
107
|
+
input = { content: input };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (typeof input.content !== 'string' && !isBuffer(input.content)) {
|
|
111
|
+
throw new TypeError('expected a buffer or string');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
input.content = input.content.toString();
|
|
115
|
+
input.sections = [];
|
|
116
|
+
return input;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function getKey(val, delim) {
|
|
120
|
+
return val ? val.slice(delim.length).trim() : '';
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function createSection() {
|
|
124
|
+
return { key: '', data: '', content: '' };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function identity(val) {
|
|
128
|
+
return val;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function isBuffer(val) {
|
|
132
|
+
if (val && val.constructor && typeof val.constructor.isBuffer === 'function') {
|
|
133
|
+
return val.constructor.isBuffer(val);
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "section-matter",
|
|
3
|
+
"description": "Like front-matter, but supports multiple sections in a document.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"homepage": "https://github.com/jonschlinkert/section-matter",
|
|
6
|
+
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
|
7
|
+
"repository": "jonschlinkert/section-matter",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/jonschlinkert/section-matter/issues"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"files": [
|
|
13
|
+
"index.js"
|
|
14
|
+
],
|
|
15
|
+
"main": "index.js",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=4"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "mocha"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"extend-shallow": "^2.0.1",
|
|
24
|
+
"kind-of": "^6.0.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"gulp-format-md": "^1.0.0",
|
|
28
|
+
"js-yaml": "^3.10.0",
|
|
29
|
+
"mocha": "^4.0.1"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"matter",
|
|
33
|
+
"section"
|
|
34
|
+
],
|
|
35
|
+
"verb": {
|
|
36
|
+
"toc": false,
|
|
37
|
+
"layout": "default",
|
|
38
|
+
"tasks": [
|
|
39
|
+
"readme"
|
|
40
|
+
],
|
|
41
|
+
"plugins": [
|
|
42
|
+
"gulp-format-md"
|
|
43
|
+
],
|
|
44
|
+
"related": {
|
|
45
|
+
"list": [
|
|
46
|
+
"gray-matter",
|
|
47
|
+
"assemble",
|
|
48
|
+
"verb"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"lint": {
|
|
52
|
+
"reflinks": true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/node_modules/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Copyright (c) 2007-2014, Alexandru Marasteanu <hello [at) alexei (dot] ro>
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
* Redistributions of source code must retain the above copyright
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
|
+
* Neither the name of this software nor the names of its contributors may be
|
|
12
|
+
used to endorse or promote products derived from this software without
|
|
13
|
+
specific prior written permission.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
19
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# sprintf.js
|
|
2
|
+
**sprintf.js** is a complete open source JavaScript sprintf implementation for the *browser* and *node.js*.
|
|
3
|
+
|
|
4
|
+
Its prototype is simple:
|
|
5
|
+
|
|
6
|
+
string sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]])
|
|
7
|
+
|
|
8
|
+
The placeholders in the format string are marked by `%` and are followed by one or more of these elements, in this order:
|
|
9
|
+
|
|
10
|
+
* An optional number followed by a `$` sign that selects which argument index to use for the value. If not specified, arguments will be placed in the same order as the placeholders in the input string.
|
|
11
|
+
* An optional `+` sign that forces to preceed the result with a plus or minus sign on numeric values. By default, only the `-` sign is used on negative numbers.
|
|
12
|
+
* An optional padding specifier that says what character to use for padding (if specified). Possible values are `0` or any other character precedeed by a `'` (single quote). The default is to pad with *spaces*.
|
|
13
|
+
* An optional `-` sign, that causes sprintf to left-align the result of this placeholder. The default is to right-align the result.
|
|
14
|
+
* An optional number, that says how many characters the result should have. If the value to be returned is shorter than this number, the result will be padded. When used with the `j` (JSON) type specifier, the padding length specifies the tab size used for indentation.
|
|
15
|
+
* An optional precision modifier, consisting of a `.` (dot) followed by a number, that says how many digits should be displayed for floating point numbers. When used with the `g` type specifier, it specifies the number of significant digits. When used on a string, it causes the result to be truncated.
|
|
16
|
+
* A type specifier that can be any of:
|
|
17
|
+
* `%` — yields a literal `%` character
|
|
18
|
+
* `b` — yields an integer as a binary number
|
|
19
|
+
* `c` — yields an integer as the character with that ASCII value
|
|
20
|
+
* `d` or `i` — yields an integer as a signed decimal number
|
|
21
|
+
* `e` — yields a float using scientific notation
|
|
22
|
+
* `u` — yields an integer as an unsigned decimal number
|
|
23
|
+
* `f` — yields a float as is; see notes on precision above
|
|
24
|
+
* `g` — yields a float as is; see notes on precision above
|
|
25
|
+
* `o` — yields an integer as an octal number
|
|
26
|
+
* `s` — yields a string as is
|
|
27
|
+
* `x` — yields an integer as a hexadecimal number (lower-case)
|
|
28
|
+
* `X` — yields an integer as a hexadecimal number (upper-case)
|
|
29
|
+
* `j` — yields a JavaScript object or array as a JSON encoded string
|
|
30
|
+
|
|
31
|
+
## JavaScript `vsprintf`
|
|
32
|
+
`vsprintf` is the same as `sprintf` except that it accepts an array of arguments, rather than a variable number of arguments:
|
|
33
|
+
|
|
34
|
+
vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"])
|
|
35
|
+
|
|
36
|
+
## Argument swapping
|
|
37
|
+
You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. You can do that by simply indicating in the format string which arguments the placeholders refer to:
|
|
38
|
+
|
|
39
|
+
sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")
|
|
40
|
+
And, of course, you can repeat the placeholders without having to increase the number of arguments.
|
|
41
|
+
|
|
42
|
+
## Named arguments
|
|
43
|
+
Format strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - `(` and `)` - and begin with a keyword that refers to a key:
|
|
44
|
+
|
|
45
|
+
var user = {
|
|
46
|
+
name: "Dolly"
|
|
47
|
+
}
|
|
48
|
+
sprintf("Hello %(name)s", user) // Hello Dolly
|
|
49
|
+
Keywords in replacement fields can be optionally followed by any number of keywords or indexes:
|
|
50
|
+
|
|
51
|
+
var users = [
|
|
52
|
+
{name: "Dolly"},
|
|
53
|
+
{name: "Molly"},
|
|
54
|
+
{name: "Polly"}
|
|
55
|
+
]
|
|
56
|
+
sprintf("Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s", {users: users}) // Hello Dolly, Molly and Polly
|
|
57
|
+
Note: mixing positional and named placeholders is not (yet) supported
|
|
58
|
+
|
|
59
|
+
## Computed values
|
|
60
|
+
You can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on-the-fly.
|
|
61
|
+
|
|
62
|
+
sprintf("Current timestamp: %d", Date.now) // Current timestamp: 1398005382890
|
|
63
|
+
sprintf("Current date and time: %s", function() { return new Date().toString() })
|
|
64
|
+
|
|
65
|
+
# AngularJS
|
|
66
|
+
You can now use `sprintf` and `vsprintf` (also aliased as `fmt` and `vfmt` respectively) in your AngularJS projects. See `demo/`.
|
|
67
|
+
|
|
68
|
+
# Installation
|
|
69
|
+
|
|
70
|
+
## Via Bower
|
|
71
|
+
|
|
72
|
+
bower install sprintf
|
|
73
|
+
|
|
74
|
+
## Or as a node.js module
|
|
75
|
+
|
|
76
|
+
npm install sprintf-js
|
|
77
|
+
|
|
78
|
+
### Usage
|
|
79
|
+
|
|
80
|
+
var sprintf = require("sprintf-js").sprintf,
|
|
81
|
+
vsprintf = require("sprintf-js").vsprintf
|
|
82
|
+
|
|
83
|
+
sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")
|
|
84
|
+
vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"])
|
|
85
|
+
|
|
86
|
+
# License
|
|
87
|
+
|
|
88
|
+
**sprintf.js** is licensed under the terms of the 3-clause BSD license.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sprintf",
|
|
3
|
+
"description": "JavaScript sprintf implementation",
|
|
4
|
+
"version": "1.0.3",
|
|
5
|
+
"main": "src/sprintf.js",
|
|
6
|
+
"license": "BSD-3-Clause-Clear",
|
|
7
|
+
"keywords": ["sprintf", "string", "formatting"],
|
|
8
|
+
"authors": ["Alexandru Marasteanu <hello@alexei.ro> (http://alexei.ro/)"],
|
|
9
|
+
"homepage": "https://github.com/alexei/sprintf.js",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git://github.com/alexei/sprintf.js.git"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html ng-app="app">
|
|
3
|
+
<head>
|
|
4
|
+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.3/angular.min.js"></script>
|
|
5
|
+
<script src="../src/sprintf.js"></script>
|
|
6
|
+
<script src="../src/angular-sprintf.js"></script>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<pre>{{ "%+010d"|sprintf:-123 }}</pre>
|
|
10
|
+
<pre>{{ "%+010d"|vsprintf:[-123] }}</pre>
|
|
11
|
+
<pre>{{ "%+010d"|fmt:-123 }}</pre>
|
|
12
|
+
<pre>{{ "%+010d"|vfmt:[-123] }}</pre>
|
|
13
|
+
<pre>{{ "I've got %2$d apples and %1$d oranges."|fmt:4:2 }}</pre>
|
|
14
|
+
<pre>{{ "I've got %(apples)d apples and %(oranges)d oranges."|fmt:{apples: 2, oranges: 4} }}</pre>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
angular.module("app", ["sprintf"])
|
|
18
|
+
</script>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! sprintf-js | Alexandru Marasteanu <hello@alexei.ro> (http://alexei.ro/) | BSD-3-Clause */
|
|
2
|
+
|
|
3
|
+
angular.module("sprintf",[]).filter("sprintf",function(){return function(){return sprintf.apply(null,arguments)}}).filter("fmt",["$filter",function(a){return a("sprintf")}]).filter("vsprintf",function(){return function(a,b){return vsprintf(a,b)}}).filter("vfmt",["$filter",function(a){return a("vsprintf")}]);
|
|
4
|
+
//# sourceMappingURL=angular-sprintf.min.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! sprintf-js | Alexandru Marasteanu <hello@alexei.ro> (http://alexei.ro/) | BSD-3-Clause */
|
|
2
|
+
|
|
3
|
+
!function(a){function b(){var a=arguments[0],c=b.cache;return c[a]&&c.hasOwnProperty(a)||(c[a]=b.parse(a)),b.format.call(null,c[a],arguments)}function c(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function d(a,b){return Array(b+1).join(a)}var e={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};b.format=function(a,f){var g,h,i,j,k,l,m,n=1,o=a.length,p="",q=[],r=!0,s="";for(h=0;o>h;h++)if(p=c(a[h]),"string"===p)q[q.length]=a[h];else if("array"===p){if(j=a[h],j[2])for(g=f[n],i=0;i<j[2].length;i++){if(!g.hasOwnProperty(j[2][i]))throw new Error(b("[sprintf] property '%s' does not exist",j[2][i]));g=g[j[2][i]]}else g=j[1]?f[j[1]]:f[n++];if("function"==c(g)&&(g=g()),e.not_string.test(j[8])&&e.not_json.test(j[8])&&"number"!=c(g)&&isNaN(g))throw new TypeError(b("[sprintf] expecting number but found %s",c(g)));switch(e.number.test(j[8])&&(r=g>=0),j[8]){case"b":g=g.toString(2);break;case"c":g=String.fromCharCode(g);break;case"d":case"i":g=parseInt(g,10);break;case"j":g=JSON.stringify(g,null,j[6]?parseInt(j[6]):0);break;case"e":g=j[7]?g.toExponential(j[7]):g.toExponential();break;case"f":g=j[7]?parseFloat(g).toFixed(j[7]):parseFloat(g);break;case"g":g=j[7]?parseFloat(g).toPrecision(j[7]):parseFloat(g);break;case"o":g=g.toString(8);break;case"s":g=(g=String(g))&&j[7]?g.substring(0,j[7]):g;break;case"u":g>>>=0;break;case"x":g=g.toString(16);break;case"X":g=g.toString(16).toUpperCase()}e.json.test(j[8])?q[q.length]=g:(!e.number.test(j[8])||r&&!j[3]?s="":(s=r?"+":"-",g=g.toString().replace(e.sign,"")),l=j[4]?"0"===j[4]?"0":j[4].charAt(1):" ",m=j[6]-(s+g).length,k=j[6]&&m>0?d(l,m):"",q[q.length]=j[5]?s+g+k:"0"===l?s+k+g:k+s+g)}return q.join("")},b.cache={},b.parse=function(a){for(var b=a,c=[],d=[],f=0;b;){if(null!==(c=e.text.exec(b)))d[d.length]=c[0];else if(null!==(c=e.modulo.exec(b)))d[d.length]="%";else{if(null===(c=e.placeholder.exec(b)))throw new SyntaxError("[sprintf] unexpected placeholder");if(c[2]){f|=1;var g=[],h=c[2],i=[];if(null===(i=e.key.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(g[g.length]=i[1];""!==(h=h.substring(i[0].length));)if(null!==(i=e.key_access.exec(h)))g[g.length]=i[1];else{if(null===(i=e.index_access.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");g[g.length]=i[1]}c[2]=g}else f|=2;if(3===f)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");d[d.length]=c}b=b.substring(c[0].length)}return d};var f=function(a,c,d){return d=(c||[]).slice(0),d.splice(0,0,a),b.apply(null,d)};"undefined"!=typeof exports?(exports.sprintf=b,exports.vsprintf=f):(a.sprintf=b,a.vsprintf=f,"function"==typeof define&&define.amd&&define(function(){return{sprintf:b,vsprintf:f}}))}("undefined"==typeof window?this:window);
|
|
4
|
+
//# sourceMappingURL=sprintf.min.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","json","not_json","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","JSON","stringify","toExponential","parseFloat","toFixed","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","replacement_field","field_match","vsprintf","_argv","splice","apply","exports","define","amd","this"],"mappings":";;CAAA,SAAUA,GAeN,QAASC,KACL,GAAIC,GAAMC,UAAU,GAAIC,EAAQH,EAAQG,KAIxC,OAHMA,GAAMF,IAAQE,EAAMC,eAAeH,KACrCE,EAAMF,GAAOD,EAAQK,MAAMJ,IAExBD,EAAQM,OAAOC,KAAK,KAAMJ,EAAMF,GAAMC,WA4JjD,QAASM,GAASC,GACd,MAAOC,QAAOC,UAAUC,SAASL,KAAKE,GAAUI,MAAM,EAAG,IAAIC,cAGjE,QAASC,GAAWC,EAAOC,GACvB,MAAOC,OAAMD,EAAa,GAAGE,KAAKH,GApLtC,GAAII,IACAC,WAAY,OACZC,OAAQ,SACRC,KAAM,MACNC,SAAU,OACVC,KAAM,YACNC,OAAQ,WACRC,YAAa,yFACb1B,IAAK,sBACL2B,WAAY,wBACZC,aAAc,aACdC,KAAM,UAWV9B,GAAQM,OAAS,SAASyB,EAAYC,GAClC,GAAiEC,GAAkBC,EAAGC,EAAGC,EAAOC,EAAKC,EAAeC,EAAhHC,EAAS,EAAGC,EAAcV,EAAWW,OAAQC,EAAY,GAASC,KAA0DC,GAAc,EAAMf,EAAO,EAC3J,KAAKI,EAAI,EAAOO,EAAJP,EAAiBA,IAEzB,GADAS,EAAYnC,EAASuB,EAA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IF,aAAY,+CAbtB,KADAC,EAAWA,EAAWzB,QAAU2B,EAAY,GACwC,MAA5ED,EAAoBA,EAAkBV,UAAUW,EAAY,GAAG3B,UACnE,GAA8D,QAAzD2B,EAAcjD,EAAGQ,WAAWqC,KAAKG,IAClCD,EAAWA,EAAWzB,QAAU2B,EAAY,OAE3C,CAAA,GAAgE,QAA3DA,EAAcjD,EAAGS,aAAaoC,KAAKG,IAIzC,KAAM,IAAIF,aAAY,+CAHtBC,GAAWA,EAAWzB,QAAU2B,EAAY,GAUxDjC,EAAM,GAAK+B,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAIlB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpC2B,EAAOA,EAAKL,UAAUtB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIuC,GAAW,SAASR,EAAK9B,EAAMuC,GAG/B,MAFAA,IAASvC,OAAYnB,MAAM,GAC3B0D,EAAMC,OAAO,EAAG,EAAGV,GACZ9D,EAAQyE,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQ1E,QAAUA,EAClB0E,QAAQJ,SAAWA,IAGnBvE,EAAOC,QAAUA,EACjBD,EAAOuE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACI3E,QAASA,EACTsE,SAAUA,OAKT,mBAAXvE,QAAyB8E,KAAO9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","json","not_json","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","JSON","stringify","toExponential","parseFloat","toFixed","toPrecision","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","replacement_field","field_match","vsprintf","_argv","splice","apply","exports","define","amd","this"],"mappings":";;CAAA,SAAUA,GAeN,QAASC,KACL,GAAIC,GAAMC,UAAU,GAAIC,EAAQH,EAAQG,KAIxC,OAHMA,GAAMF,IAAQE,EAAMC,eAAeH,KACrCE,EAAMF,GAAOD,EAAQK,MAAMJ,IAExBD,EAAQM,OAAOC,KAAK,KAAMJ,EAAMF,GAAMC,WA+JjD,QAASM,GAASC,GACd,MAAOC,QAAOC,UAAUC,SAASL,KAAKE,GAAUI,MAAM,EAAG,IAAIC,cAGjE,QAASC,GAAWC,EAAOC,GACvB,MAAOC,OAAMD,EAAa,GAAGE,KAAKH,GAvLtC,GAAII,IACAC,WAAY,OACZC,OAAQ,UACRC,KAAM,MACNC,SAAU,OACVC,KAAM,YACNC,OAAQ,WACRC,YAAa,yFACb1B,IAAK,sBACL2B,WAAY,wBACZC,aAAc,aACdC,KAAM,UAWV9B,GAAQM,OAAS,SAASyB,EAAYC,GAClC,GAAiEC,GAAkBC,EAAGC,EAAGC,EAAOC,EAAKC,EAAeC,EAAhHC,EAAS,EAAGC,EAAcV,EAAWW,OAAQC,EAAY,GAASC,KAA0DC,GAAc,EAAMf,EAAO,EAC3J,KAAKI,EAAI,EAAOO,EAAJP,EAAiBA,IAEzB,GADAS,EAAYnC,EAASuB,EAAWG,IACd,WAAdS,EACAC,EAAOA,EAAOF,QAAUX,EAAWG,OAElC,IAAkB,UAAdS,EAAuB,CAE5B,GADAP,EAAQL,EAAWG,GACfE,EAAM,GAEN,IADAH,EAAMD,EAAKQ,GACNL,EAAI,EAAGA,EAAIC,EAAM,GAAGM,OAAQP,IAAK,CAClC,IAAKF,EAAI7B,eAAegC,EAAM,GAAGD,IAC7B,KAAM,IAAIW,OAAM9C,EAAQ,yCAA0CoC,EAAM,GAAGD,IAE/EF,GAAMA,EAAIG,EAAM,GAAGD,QAIvBF,GADKG,EAAM,GACLJ,EAA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F,aAAY,+CAHtBC,GAAWA,EAAW1B,QAAU4B,EAAY,GAUxDlC,EAAM,GAAKgC,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAInB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpC4B,EAAOA,EAAKL,UAAUvB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIwC,GAAW,SAASR,EAAK/B,EAAMwC,GAG/B,MAFAA,IAASxC,OAAYnB,MAAM,GAC3B2D,EAAMC,OAAO,EAAG,EAAGV,GACZ/D,EAAQ0E,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQ3E,QAAUA,EAClB2E,QAAQJ,SAAWA,IAGnBxE,EAAOC,QAAUA,EACjBD,EAAOwE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACI5E,QAASA,EACTuE,SAAUA,OAKT,mBAAXxE,QAAyB+E,KAAO/E"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module.exports = function(grunt) {
|
|
2
|
+
grunt.initConfig({
|
|
3
|
+
pkg: grunt.file.readJSON("package.json"),
|
|
4
|
+
|
|
5
|
+
uglify: {
|
|
6
|
+
options: {
|
|
7
|
+
banner: "/*! <%= pkg.name %> | <%= pkg.author %> | <%= pkg.license %> */\n",
|
|
8
|
+
sourceMap: true
|
|
9
|
+
},
|
|
10
|
+
build: {
|
|
11
|
+
files: [
|
|
12
|
+
{
|
|
13
|
+
src: "src/sprintf.js",
|
|
14
|
+
dest: "dist/sprintf.min.js"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
src: "src/angular-sprintf.js",
|
|
18
|
+
dest: "dist/angular-sprintf.min.js"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
watch: {
|
|
25
|
+
js: {
|
|
26
|
+
files: "src/*.js",
|
|
27
|
+
tasks: ["uglify"]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
grunt.loadNpmTasks("grunt-contrib-uglify")
|
|
33
|
+
grunt.loadNpmTasks("grunt-contrib-watch")
|
|
34
|
+
|
|
35
|
+
grunt.registerTask("default", ["uglify", "watch"])
|
|
36
|
+
}
|