Skip to content

Commit

Permalink
feat!: implement the first idea
Browse files Browse the repository at this point in the history
  • Loading branch information
demouth committed Mar 25, 2022
1 parent 004e337 commit 8a29412
Show file tree
Hide file tree
Showing 13 changed files with 10,814 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
presets: [
[
"@babel/preset-env",
],
],
};
20 changes: 20 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2.1

orbs:
node: circleci/[email protected]

jobs:
build-and-test:
docker:
- image: cimg/node:15.1
steps:
- checkout
- node/install-packages
- run:
name: Run tests
command: npm test

workflows:
run-test:
jobs:
- build-and-test
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
21 changes: 21 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
node_modules
dist
yarn-error.log
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
# mb_strwidth
# mb_strwidth

mb_strwidth ported to JavaScript.

[![CircleCI](https://circleci.com/gh/demouth/mb_strwidth/tree/main.svg?style=svg)](https://circleci.com/gh/demouth/mb_strwidth/tree/main)

## Installation

```sh
npm install @demouth/mb_strwidth
```

## Examples

This package has the same result as `mb_strwidth()` in PHP.

```js
console.log(mb_strwidth('𩸽定食食べたい😭')); // 15
```

```php
// PHP 7.3.28
var_dump(mb_strwidth('𩸽定食食べたい😭')); // int(15)
```

https://www.php.net/manual/en/function.mb-strwidth.php
Loading

0 comments on commit 8a29412

Please sign in to comment.