sd-wildcards-utils
TypeScript icon, indicating that this package has built-in type declarations

1.3.6 • Public • Published

README.md

Parse Stable Diffusion wildcards source to a YAML object.

https://civitai.com/models/449400

install

yarn add sd-wildcards-utils
yarn-tool add sd-wildcards-utils
yt add sd-wildcards-utils

Demo

import { parseWildcardsYaml, stringifyWildcardsYamlData } from 'sd-wildcards-utils';

let input = `
xxx:
  a:
    - >-
      (silhouette:1.2), jianying,
      1girl, nude,
      (in river), splash,
      ({sun rays, sunset|moonlight|dawn|twilight} background, low horizon),
      backlighting,
      contour light, body contour light, light particles,
      __lazy-wildcards/prompts/hair__,
      __lazy-wildcards/dataset/background-color__,
      (flower, falling petals, petals on liquid, petals, cherry blossom:0.8)
    - >-
      (silhouette:1.2), jianying,
      1girl, nude,
      (in river), splash,
      ({sun rays, sunset|moonlight|dawn|twilight} background, low horizon),
      backlighting,
      contour light, body contour light, light particles,
      __lazy-wildcards/prompts/hair__,
      __lazy-wildcards/dataset/background-color__,
      (flower, falling petals, petals on liquid, petals, cherry blossom:0.8)
    - "(silhouette:1.2), jianying, 1girl, nude, (in river), splash, ({sun rays, sunset|moonlight|dawn|twilight} background, low horizon), backlighting, contour light, body contour light, light particles, __lazy-wildcards/prompts/hair__, __lazy-wildcards/dataset/background-color__, (flower, falling petals, petals on liquid, petals, cherry blossom:0.8)"
    - |-
      (silhouette:1.2), jianying, 1girl, nude, (in river), splash, ({sun rays, sunset|moonlight|dawn|twilight} background, low horizon), backlighting, contour light, body contour light, light particles, __lazy-wildcards/prompts/hair__, __lazy-wildcards/dataset/background-color__, (flower, falling petals, petals on liquid, petals, cherry blossom:0.8)
`;

let doc = parseWildcardsYaml(input);
doc.contents;
let node = doc.getIn(['xxx', 'a']);
// @ts-ignore
let items = node.items;
console.dir(items, {
	depth: null,
});

console.log(`============`)

let out = doc.toString();

console.log(out)

console.log(`============`)

console.log(stringifyWildcardsYamlData(doc))
============
xxx:
  a:
    - >-
      (silhouette:1.2), jianying, 1girl, nude, (in river), splash, ({sun rays,
      sunset|moonlight|dawn|twilight} background, low horizon), backlighting,
      contour light, body contour light, light particles,
      __lazy-wildcards/prompts/hair__,
      __lazy-wildcards/dataset/background-color__, (flower, falling petals,
      petals on liquid, petals, cherry blossom:0.8)
    - >-
      (silhouette:1.2), jianying, 1girl, nude, (in river), splash, ({sun rays,
      sunset|moonlight|dawn|twilight} background, low horizon), backlighting,
      contour light, body contour light, light particles,
      __lazy-wildcards/prompts/hair__,
      __lazy-wildcards/dataset/background-color__, (flower, falling petals,
      petals on liquid, petals, cherry blossom:0.8)
    - "(silhouette:1.2), jianying, 1girl, nude, (in river), splash, ({sun rays,
      sunset|moonlight|dawn|twilight} background, low horizon), backlighting,
      contour light, body contour light, light particles,
      __lazy-wildcards/prompts/hair__,
      __lazy-wildcards/dataset/background-color__, (flower, falling petals,
      petals on liquid, petals, cherry blossom:0.8)"
    - |-
      (silhouette:1.2), jianying, 1girl, nude, (in river), splash, ({sun rays, sunset|moonlight|dawn|twilight} backgroun
nd, low horizon), backlighting, contour light, body contour light, light particles, __lazy-wildcards/prompts/hair__, __la
azy-wildcards/dataset/background-color__, (flower, falling petals, petals on liquid, petals, cherry blossom:0.8)

============
xxx:
  a:
    - >-
      (silhouette:1.2), jianying, 1girl, nude, (in river), splash, ({sun rays,
      sunset|moonlight|dawn|twilight} background, low horizon), backlighting,
      contour light, body contour light, light particles,
      __lazy-wildcards/prompts/hair__,
      __lazy-wildcards/dataset/background-color__, (flower, falling petals,
      petals on liquid, petals, cherry blossom:0.8)

SYNTAX

OTHERS

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.3.65latest

Version History

VersionDownloads (Last 7 Days)Published
1.3.65
1.3.51
1.3.41
1.3.21
1.3.11
1.2.13
1.1.11
1.0.291
1.0.281
1.0.271
1.0.261
1.0.251
1.0.241
1.0.231
1.0.221
1.0.211
1.0.201
1.0.191
1.0.181
1.0.171
1.0.161
1.0.151
1.0.141
1.0.131
1.0.121
1.0.111
1.0.101
1.0.91
1.0.81
1.0.71
1.0.61
1.0.51
1.0.41
1.0.31
1.0.21
1.0.11

Package Sidebar

Install

npm i sd-wildcards-utils

Weekly Downloads

42

Version

1.3.6

License

ISC

Unpacked Size

486 kB

Total Files

27

Last publish

Collaborators

  • bluelovers