New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

commonform-terminal

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commonform-terminal - npm Package Compare versions

Comparing version 0.9.2 to 1.0.0

test.log

32

document.js
/* Copyright Kyle E. Mitchell
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*

@@ -10,15 +10,17 @@ * http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
var decimalStyle = require('decimal-numbering');
var flatten = require('commonform-flatten');
var paragraph = require('./paragraph');
var flatten = require('commonform-flatten')
var paragraph = require('./paragraph')
module.exports = function(form, values) {
return flatten(form, values).map(function(element) {
return paragraph(element, decimalStyle);
}).join('');
};
module.exports = function (form, values, options) {
var numbering = options.numbering
return flatten(form, values)
.map(function (element) {
return paragraph(element, numbering)
})
.join('')
}
/* Copyright Kyle E. Mitchell
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*

@@ -10,12 +10,12 @@ * http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
var doc = require('./document');
var doc = require('./document')
module.exports = function() {
var codes = doc.apply(this, arguments);
return codes.slice(0, codes.length - 2);
};
module.exports = function () {
var codes = doc.apply(this, arguments)
return codes.slice(0, codes.length - 2)
}
{
"name": "commonform-terminal",
"description": "display Common Forms at text terminals",
"version": "0.9.2",
"version": "1.0.0",
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (http://kemitchell.com)",
"bugs": "https://github.com/commonform/commonform-terminal/issues",
"dependencies": {
"chalk": "^1.0.0",
"commonform-flatten": "0.8.x",
"decimal-numbering": "^1.1.0"
"chalk": "^2.1.0",
"commonform-flatten": "^0.8.1"
},
"devDependencies": {
"defence-cli": "~1.0.1",
"replace-require-self": "~1.0.0"
"decimal-numbering": "^2.0.1",
"defence-cli": "^2.0.1",
"replace-require-self": "^1.1.1",
"standard": "^10.0.3",
"standard-markdown": "^4.0.2"
},

@@ -30,4 +32,5 @@ "homepage": "https://commonform.github.io",

"scripts": {
"test": "defence README.md | replace-require-self | node"
"test": "FORCE_COLOR=1 defence README.md | replace-require-self | node",
"lint": "standard && standard-markdown"
}
}
/* Copyright Kyle E. Mitchell
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*

@@ -10,25 +10,28 @@ * http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
var chalk = require('chalk');
var run = require('./run');
var chalk = require('chalk')
var run = require('./run')
var TAB = ' ';
var TAB = ' '
module.exports = function(paragraph, numberStyle) {
var number = paragraph.hasOwnProperty('numbering') ?
paragraph.numbering : '';
var conspicuous = paragraph.hasOwnProperty('conspicuous');
module.exports = function (paragraph, numberStyle) {
var number = paragraph.hasOwnProperty('numbering')
? paragraph.numbering
: ''
var conspicuous = paragraph.hasOwnProperty('conspicuous')
return new Array(paragraph.depth * 4 + 1).join(' ') +
(number ?
chalk.gray(numberStyle(number)) + TAB : '') +
(paragraph.hasOwnProperty('heading') ?
chalk.blue.underline(paragraph.heading) + '. ' : '') +
paragraph.content.map(function(element) {
return run(element, numberStyle, conspicuous);
(number ? chalk.gray(numberStyle(number)) + TAB : '') +
(
paragraph.hasOwnProperty('heading')
? chalk.blue.underline(paragraph.heading) + '. '
: ''
) +
paragraph.content.map(function (element) {
return run(element, numberStyle, conspicuous)
}).join('') +
'\n\n';
};
'\n\n'
}
```javascript
var terminal = require('commonform-terminal')
var decimal = require('decimal-numbering')
var assert = require('assert')

@@ -7,49 +8,60 @@

terminal(
{ "content": [
"This ",
{ use: "Agreement" },
" (this ",
{ "definition": "Agreement" },
" is made effective as of the date the last ",
{ "use": "Party" },
" signs this ",
{ "use": "Agreement" },
" (the ",
{ "definition": "Effective Date" },
") by and between ",
{ "blank": "" },
", a ",
{ "blank": "" },
" (",
{ "definition": "Company" },
") and the several purchasers named in ",
{ "reference": "Purchasers" },
" (",
{ "definition": "Purchasers" },
", and together with ",
{ use: "Company"},
", each a ",
{ "definition": "Party" },
")." ] },
[ /* no blank values */ ],
{ /* no options */ }),
[ " This \u001b[35mAgreement\u001b[39m (this \"",
"\u001b[32mAgreement\u001b[39m\" is made effective as of ",
"the date the last \u001b[35mParty\u001b[39m signs this ",
"\u001b[35mAgreement\u001b[39m (the \"\u001b[32mEffective ",
"Date\u001b[39m\") by and between \u001b[31m\u001b[4m[_]",
"\u001b[24m\u001b[39m, a \u001b[31m\u001b[4m[_]",
"\u001b[24m\u001b[39m (\"\u001b[32mCompany",
"\u001b[39m\") and the several purchasers named in \u001b[33m",
"Purchasers\u001b[39m (\"\u001b[32mPurchasers\u001b[39m\", and ",
"together with \u001b[35mCompany\u001b[39m, each a \"\u001b[32m",
"Party\u001b[39m\")." ].join(''))
{
content: [
'This ',
{use: 'Agreement'},
' (this ',
{definition: 'Agreement'},
' is made effective as of the date the last ',
{use: 'Party'},
' signs this ',
{use: 'Agreement'},
' (the ',
{definition: 'Effective Date'},
') by and between ',
{blank: ''},
', a ',
{blank: ''},
' (',
{definition: 'Company'},
') and the several purchasers named in ',
{reference: 'Purchasers'},
' (',
{definition: 'Purchasers'},
', and together with ',
{use: 'Company'},
', each a ',
{definition: 'Party'},
').'
]
},
[/* no blank values */],
{numbering: decimal}),
[
' This \u001b[35mAgreement\u001b[39m (this "',
'\u001b[32mAgreement\u001b[39m" is made effective as of ',
'the date the last \u001b[35mParty\u001b[39m signs this ',
'\u001b[35mAgreement\u001b[39m (the "\u001b[32mEffective ',
'Date\u001b[39m") by and between \u001b[31m\u001b[4m[_]',
'\u001b[24m\u001b[39m, a \u001b[31m\u001b[4m[_]',
'\u001b[24m\u001b[39m ("\u001b[32mCompany',
'\u001b[39m") and the several purchasers named in \u001b[33m',
'Purchasers\u001b[39m ("\u001b[32mPurchasers\u001b[39m", and ',
'together with \u001b[35mCompany\u001b[39m, each a "\u001b[32m',
'Party\u001b[39m").'
].join('')
)
assert.equal(
terminal(
{ "content": [ { "blank": "" } ] },
[ { blank: [ 'content', 0 ],
value: 'NewCo, Inc.' } ],
{ /* no options */ }),
" \u001b[31m\u001b[4m[NewCo, Inc.]\u001b[24m\u001b[39m")
{content: [{blank: ''}]},
[
{
blank: ['content', 0],
value: 'NewCo, Inc.'
}
],
{numbering: decimal}),
' \u001b[31m\u001b[4m[NewCo, Inc.]\u001b[24m\u001b[39m'
)
```
/* Copyright Kyle E. Mitchell
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*

@@ -10,25 +10,25 @@ * http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
var chalk = require('chalk');
var chalk = require('chalk')
module.exports = function run(element, numberStyle, conspicuous) {
module.exports = function run (element, numberStyle, conspicuous) {
if (typeof element === 'string') {
return conspicuous ? chalk.magenta(element) : element;
return conspicuous ? chalk.magenta(element) : element
} else if (element.hasOwnProperty('definition')) {
return '"' + chalk.green(element.definition) + '"';
return '"' + chalk.green(element.definition) + '"'
} else if (element.hasOwnProperty('use')) {
return chalk.magenta(element.use);
return chalk.magenta(element.use)
} else if (element.hasOwnProperty('blank')) {
if (element.blank === undefined) {
return chalk.red.underline('[_]');
return chalk.red.underline('[_]')
} else {
return chalk.red.underline('[' + element.blank + ']');
return chalk.red.underline('[' + element.blank + ']')
}
} else if (element.hasOwnProperty('heading')) {
var numbering = element.numbering;
var heading = element.heading;
var numbering = element.numbering
var heading = element.heading
if (

@@ -38,3 +38,3 @@ element.hasOwnProperty('broken') ||

) {
return chalk.yellow(heading);
return chalk.yellow(heading)
} else {

@@ -44,7 +44,7 @@ return chalk.cyan(

' (' + heading + ')'
);
)
}
} else {
throw new Error('Invalid type: ' + JSON.stringify(element));
throw new Error('Invalid type: ' + JSON.stringify(element))
}
};
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc