JavaScriptを使用する新しいNPMパッケージ


devのコミュニティを歓迎する!
今日は、初心者や高度なJavaScript開発者にとって便利なNPMパッケージを紹介したいと思います.
これは、Pythonから触発され、JavaScriptのために書き直された関数のコレクションですので、今は簡単に文字列やディスプレイなどの文字列から最後の4文字を使用することができます.
それをチェックアウトするには
$ npm install simhok
# or
$ yarn add simhok
今私たちがしなければならないのはJSプロジェクトにパッケージをインポートすることです
// Import what you need
import { len, log } from "simhok"

// Import all functions
import * as Sim from "simhok"

// In node.js
const { len, log } = require("simhok");
利用できる関数
const user = "sebastian";
const users = ["sebastian", "klaudia"];
const hello = "hello world";

len(user);             // number:9
len(users);            // number: 2
capitalize(hello);     // string: Hello world
capitalizeAll(hello);  // string: Hello World
upper(user);           // string: SEBASTIAN
lower(user);           // string: sebastian

startsWith(user, "s"); // boolean: true
startsWith(user, "S"); // boolean: false
endsWith(user, "n");   // boolean: true

rstrip(user, "an");    // string: sebasti
lstrip(user, "s");     // string: ebastian

split(user, [0]);      // string: s
split(user, [0, 2]);   // string: se
split(user, [3, 0]);   // string: astian
split(user, [0, -3]);  // string: ian

let james_bond = 7;
zfill(james_bond, 2);  // string: 007

count([1,2,1,3,1], 1); // number: 3
compareIgnoreCase("Sebastian", "sebastian"); // boolean: true

abs(42);              // number: -42
abs(-42);             // number: 42

n("1_000_000")        // number: 1000000

log("This is pretty awesome 🎉"); // "This is pretty awesome 🎉"
反応の例
import { len, upper } from "simhok"; 

const App = () => {
  let name = upper("Sebastian");
  let users = len(["Sebastian", "Klaudia"]);

  return <div>{users > 0 && name}</div>;
};
import * as Sim from "simhok"; 

const App = () => {
  let name = Sim.upper("Sebastian");
  let users = Sim.len(["Sebastian", "Klaudia"]);

  return <div>{users > 0 && name}</div>;
};

スコタトヴィッツ / シムホーク


あなたがおそらく毎日使用する機能の軽量で使いやすいライブラリ


私はあなたがパッケージについて何を考えているかをいくつかの意見をテストして書くように勧めます.
私は喜んでPRを受け入れる!
以下を編集してください:16/06/2021