@putout/processor-yaml
Advanced tools
Comparing version 6.0.0 to 7.0.0
import tryCatch from 'try-catch'; | ||
import justKebabCase from 'just-kebab-case'; | ||
import yaml from 'yaml'; | ||
import * as jsonProcessor from '@putout/processor-json'; | ||
import { | ||
__yaml, | ||
__yaml_name, | ||
toJS, | ||
fromJS, | ||
} from '@putout/operator-json'; | ||
const isYaml = (a) => !a.indexOf(__yaml_name); | ||
const parseRule = (a) => justKebabCase(a.replace('YAML', 'Yaml')); | ||
@@ -22,3 +28,3 @@ const {stringify, parse} = JSON; | ||
const stringified = stringify(value, null, 2); | ||
const [{source}] = jsonProcessor.branch(stringified, null, 2); | ||
const source = toJS(stringified, __yaml); | ||
@@ -44,4 +50,6 @@ list.push({ | ||
export const merge = (rawSource, list) => { | ||
const source = jsonProcessor.merge(rawSource, list); | ||
const [first] = list.filter(isYaml); | ||
const source = fromJS(first, __yaml); | ||
return yaml.stringify(parse(source)); | ||
@@ -60,3 +68,2 @@ }; | ||
const {message, linePos} = error; | ||
const [rule] = String(error).split(':'); | ||
@@ -63,0 +70,0 @@ |
{ | ||
"name": "@putout/processor-yaml", | ||
"version": "6.0.0", | ||
"version": "7.0.0", | ||
"type": "module", | ||
@@ -27,2 +27,3 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
"dependencies": { | ||
"@putout/operator-json": "^1.3.0", | ||
"@putout/processor-json": "^7.0.1", | ||
@@ -43,5 +44,6 @@ "just-kebab-case": "^4.0.2", | ||
"eslint-plugin-n": "^16.0.0", | ||
"eslint-plugin-putout": "^19.0.0", | ||
"eslint-plugin-putout": "^21.0.0", | ||
"lerna": "^6.0.1", | ||
"madrun": "^9.0.0", | ||
"montag": "^1.2.1", | ||
"nodemon": "^3.0.1", | ||
@@ -48,0 +50,0 @@ "putout": "*" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4844
64
5
10
+ Added@putout/operator-json@^1.3.0
+ Added@putout/operator-json@1.3.0(transitive)