readMeteorStrength関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What a page's meteors-strength attribute means: a number from 0 (no streaks are drawn) to 1 (the full look), given as it is written; with none, or something that
is not a number, METEOR_STRENGTH_DEFAULT. A number outside the range is brought to its nearest end.
インポート
import { readMeteorStrength } from "@johnmorrisdotca/chikyu-earth/meteors";
定義
function readMeteorStrength(given: string | null): number
引数
| 名前 | 型 | 説明 |
|---|---|---|
given | string | null | The attribute's value, or |
戻り値
number
How strongly the streaks are drawn, between 0 and 1.
例
import { readMeteorStrength } from "@johnmorrisdotca/chikyu-earth/meteors";
console.log(readMeteorStrength(null), readMeteorStrength("0.3"), readMeteorStrength("7"), readMeteorStrength("-1"), readMeteorStrength("soft")); // 1 0.3 1 0 11 0.3 1 0 1出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。