{ "strings.js": { "name": "strings", "path": "../fixtures/strings.js", "comments": [ [ { "description": "## new Strings()\n\n> Strings constructor method\n\nInstantiate a new instance of Strings, optionally passing a default context to use.", "return": "{Object} Instance of a Strings object", "line": 17 }, { "description": "## .propstring (name, propstring)\n\nGet or set a propstring.\n\n**Example**\n\n```js\nstrings.propstring('permalinks', ':destBase/:dirname/:basename/index.:ext');\n```", "param": [ "{String} `name`", "{String} `propstring`" ], "return": "{Object} Instance of the current Strings object", "api": "public", "params": [ { "type": "String", "name": "`name`", "description": "" }, { "type": "String", "name": "`propstring`", "description": "" } ], "line": 42 }, { "description": "## .pattern (name, pattern)\n\nGet or set regular expression or string.\n\n**Example**\n\n```js\nstrings.pattern('prop', ':([\\\\w]+)');\n```", "param": [ "{String} `name`", "{String} `pattern`" ], "return": "{Object} Instance of the current Strings object", "api": "public", "params": [ { "type": "String", "name": "`name`", "description": "" }, { "type": "String", "name": "`pattern`", "description": "" } ], "line": 68 }, { "description": "## .replacement (name, replacement)\n\nGet or set a replacement string or function.\n\n**Example**\n\n```js\nstrings.replacement('prop', function(match) {\n return match.toUpperCase();\n});\n```", "param": [ "{String} `name`", "{String} `replacement`" ], "return": "{Object} Instance of the current Strings object", "api": "public", "params": [ { "type": "String", "name": "`name`", "description": "" }, { "type": "String", "name": "`replacement`", "description": "" } ], "line": 97 }, { "description": "## .parser ( name, replacement-patterns )\n\nDefine a named parser to be used against any given string.\n\n**Example**\n\nPass an object:\n\n```js\nstrings.parser('prop', {\n pattern: /:([\\\\w]+)/,\n replacement: function(match) {\n return match.toUpperCase();\n }\n);\n```\n\nOr an array\n\n```js\nstrings.parser('prop', [\n {\n pattern: 'a',\n replacement: 'b'\n },\n {\n pattern: 'c',\n replacement: 'd'\n }\n]);\n```", "param": [ "{String} `name` name of the parser.", "{Object|Array} `pairings` array of replacement patterns to store with the given name.", "{String|RegExp} `pattern`", "{String|Function} `replacement`" ], "return": "{Object} Instance of the current Strings object", "api": "public", "params": [ { "type": "String", "name": "`name`", "description": "name of the parser." }, { "type": "Object|Array", "name": "`pairings`", "description": "array of replacement patterns to store with the given name." }, { "type": "String|RegExp", "name": "`pattern`", "description": "" }, { "type": "String|Function", "name": "`replacement`", "description": "" } ], "line": 125 }, { "description": "## .extend ( parser, replacement-patterns )\n\nExtend a parser.\n\n**Example**\n\n```js\nstrings.extend('prop', {\n pattern: /:([\\\\w]+)/,\n replacement: function(match) {\n return match.toUpperCase();\n }\n);\n```", "param": [ "{String} `name` name of the parser to extend.", "{Object|Array} `arr` array of replacement patterns to store with the given name.", "{String|RegExp} `pattern`", "{String|Function} `replacement`" ], "return": "{Object} Instance of the current Strings object", "api": "public", "params": [ { "type": "String", "name": "`name`", "description": "name of the parser to extend." }, { "type": "Object|Array", "name": "`arr`", "description": "array of replacement patterns to store with the given name." }, { "type": "String|RegExp", "name": "`pattern`", "description": "" }, { "type": "String|Function", "name": "`replacement`", "description": "" } ], "line": 176 }, { "description": "## .parsers ( parsers )\n\nReturn a list of parsers based on the given list of named\nparsers or parser objects.\n\n**Example**\n\n```js\n// pass an array of parser names\nstrings.parsers(['a', 'b', 'c']);\n\n// or a string\nstrings.parsers('a');\n```", "param": "{String|Array} `parsers` named parsers or parser objects to use.", "return": "{Array}", "api": "public", "params": [ { "type": "String|Array", "name": "`parsers`", "description": "named parsers or parser objects to use." } ], "line": 208 }, { "description": "## .template( name, propstring, parsers )\n\nStore, by name, a named propstring and an array of parsers.\n\n**Example**\n\n```js\n// strings.template(name string, array);\nstrings.template('prop', ['prop'], {\n foo: 'aaa',\n bar: 'bbb',\n baz: 'ccc'\n});\n```", "param": [ "{String} `name` The name of the template to store", "{String} `name` Name of replacement group to use for building the final string", "{Object} `context` Optional Object to bind to replacement function as `this`" ], "return": "{String}", "api": "public", "params": [ { "type": "String", "name": "`name`", "description": "The name of the template to store" }, { "type": "String", "name": "`name`", "description": "Name of replacement group to use for building the final string" }, { "type": "Object", "name": "`context`", "description": "Optional Object to bind to replacement function as `this`" } ], "line": 255 }, { "description": "## .transform( named-propstring, named-parsers, context)\n\nSimilar to `.process`, except that the first parameter is the name\nof the stored `propstring` to use, rather than any given string.\n\n**Example**\n\n```js\nstrings.transform('propstring', ['parser'], {\n foo: 'aaa',\n bar: 'bbb',\n baz: 'ccc'\n});\n```\n\nOr pass an object, `strings.transform({})`:\n\n```js\nstrings.transform({\n propstring: 'prop',\n parsers: ['prop'],\n context: {\n foo: 'aaa',\n bar: 'bbb',\n baz: 'ccc'\n }\n});\n```", "param": [ "{String} `name` The name of the stored template to use", "{Object} `context` The optional context object to bind to replacement functions as `this`" ], "return": "{String}", "api": "public", "params": [ { "type": "String", "name": "`name`", "description": "The name of the stored template to use" }, { "type": "Object", "name": "`context`", "description": "The optional context object to bind to replacement functions as `this`" } ], "line": 299 }, { "description": "## .use( named-propstring, named-parsers, context)\n\nSimilar to `.process`, except that the first parameter is the name\nof the stored `propstring` to use, rather than any given string.\n\n**Example**\n\n```js\nstrings.use('propstring', ['parser'], {\n foo: 'aaa',\n bar: 'bbb',\n baz: 'ccc'\n});\n```\n\nOr pass an object, `strings.use({})`:\n\n```js\nstrings.use({\n propstring: 'prop',\n parsers: ['prop'],\n context: {\n foo: 'aaa',\n bar: 'bbb',\n baz: 'ccc'\n }\n});\n```", "param": [ "{String} `name` The name of the stored template to use", "{Object} `context` The optional context object to bind to replacement functions as `this`" ], "return": "{String}", "api": "public", "params": [ { "type": "String", "name": "`name`", "description": "The name of the stored template to use" }, { "type": "Object", "name": "`context`", "description": "The optional context object to bind to replacement functions as `this`" } ], "line": 346 }, { "description": "## .process (str, parsers, context)\n\nDirectly process the given string, using a named replacement\npattern or array of named replacement patterns, with the given\ncontext.\n\n**Example**\n\n```js\nstrings.process(':foo/:bar/:baz', ['a', 'b', 'c'], {\n foo: 'aaa',\n bar: 'bbb',\n baz: 'ccc'\n});\n```", "param": [ "{String} `str` the string to process", "{String|Object|Array} `parsers` named parsers or parser objects to use when processing.", "{Object} `context` context to use. optional if a global context is passed." ], "return": "{String}", "api": "public", "params": [ { "type": "String", "name": "`str`", "description": "the string to process" }, { "type": "String|Object|Array", "name": "`parsers`", "description": "named parsers or parser objects to use when processing." }, { "type": "Object", "name": "`context`", "description": "context to use. optional if a global context is passed." } ], "line": 388 }, { "description": "## .group ( name, propstring, parsers )\n\nDefine a named group of propstring/parser mappings, or get a\ngroup if only the name is passed.\n\n**Example**\n\n```js\nstrings.group('my-group-name', ':foo/:bar/:baz', ['a', 'b', 'c']);\n```\n\nTo get a group:\n\n```js\nstrings.group( name );\n```", "param": [ "{String} `name`", "{String} `propstring` the name of the propstring to use", "{String|Array} `parsers` name or array of names of parsers to use" ], "return": "{Object} Instance of the current Strings object", "api": "public", "params": [ { "type": "String", "name": "`name`", "description": "" }, { "type": "String", "name": "`propstring`", "description": "the name of the propstring to use" }, { "type": "String|Array", "name": "`parsers`", "description": "name or array of names of parsers to use" } ], "line": 419 }, { "description": "## .run ( groupname, context )\n\nProcess the specified group using the given context.\n\n**Example**\n\nSet: (`strings.run( string, object )`)\n\n```js\nstrings.run('my-group-name', {\n foo: 'aaa',\n bar: 'bbb',\n baz: 'ccc'\n});\n```", "param": [ "{String} `group` The group to run.", "{Object} `context` Optional context object, to bind to replacement function as `this`" ], "return": "{String}", "api": "public", "params": [ { "type": "String", "name": "`group`", "description": "The group to run." }, { "type": "Object", "name": "`context`", "description": "Optional context object, to bind to replacement function as `this`" } ], "line": 456 } ] ] } }