Skip to content

Instantly share code, notes, and snippets.

@think49
think49 / eval-calculation-1.0.0.js
Last active October 18, 2023 15:04
eval-calculation.js: 計算式の文字列を評価する
/**
* eval-calculation.js
* evaluate calculation formula.
*
* @version 1.0.0
* @author think49
* @url https://gist.github.com/think49/54b074cab2145efddb48765652c74710
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/

[JavaScript] オブジェクト, Map, WeakMap の使い分け方

概要

JavaScript で下記4点を連想配列として用いる場合の使い分け方を解説します。

  • オブジェクト初期化子
  • Object.create(null)
  • Map
  • WeakMap
@think49
think49 / readme.md
Last active February 9, 2023 17:15
InputEvent#isComposing とIME有効/無効の検出
@think49
think49 / History.md
Last active July 12, 2022 05:36
csv.js: ES5 規定の JSON と同じインターフェースを持つCSVパーサ

更新履歴 (csv.js)

ver 1.0.3 (2016/05/11)

  • CSV.parse() の内部実装を String.prototype.replace から RegExp.prototype.exec に変更した

ver 1.0.2 (2016/05/11)

  • CSV.parse() で第三引数 reviver が指定された場合、配列化する前にセル値を引数にとるコールバック関数 reviver を呼び出すようにした
  • CSV.stringify() で第三引数 replacer が指定された場合、CSV文字列に変換する前に要素値を引数にとるコールバック関数 replacer を呼び出すようにした

ver 1.0.1 (2016/05/10)

@think49
think49 / [html,css,javascript]-idname&classname-specification.md
Last active June 2, 2022 07:22
[HTML, CSS, JavaScript] id名/class名に使用できる文字の種類
@think49
think49 / escaperegexpchar.js
Last active April 2, 2022 10:11
escaperegexpchar.js: 正規表現文字列をエスケープします(ES5準拠)。エスケープ文字列は new RegExp() に渡すことができます。
/**
* escaperegexpchar.js
* Escape the regular expression string (ES5 compliant).
* Escape string can be passed to the () new RegExp().
*
* @version 1.0.2
* @author think49
* @url https://gist.github.com/think49/7691225
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
* @see <a href="http://es5.github.io/#x15.10.1">15.10.1 Patterns - Annotated ES5.1</a>
@think49
think49 / Webブラウザのウインドウのスクロール量を取得する.md
Last active October 4, 2021 03:29
Webブラウザのウインドウのスクロール量を取得する.md
@think49
think49 / json-for-date-1.0.2.js
Last active September 17, 2021 03:05
json-for-date.js: DateオブジェクトをJSON拡張形式にシリアライズ/パースの相互変換
/**
* json-for-date-1.0.2.js
* JSON which can serialize Date object
*
* @version 1.0.2
* @author think49
* @url https://gist.github.com/think49/26fcddaaa63cd0d6b27de8ef9c514c41
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
@think49
think49 / ReadMe.md
Last active September 13, 2021 13:20
const-map.js: 定義済みの `key` の `set()` した時にエラーを発生させる `new Map` 互換オブジェクトを生成します

const-map.js

概要

定義済みの keyset() した時にエラーを発生させる new Map 互換オブジェクトを生成します。

@think49
think49 / to-hankaku.js
Created May 10, 2011 14:38
to-hankaku.js, to-zenkaku.js : 半角文字/全角文字をそれぞれ変換する
/**
* to-hankaku.js
* convert to ascii code strings.
*
* @version 1.0.1
* @author think49
* @url https://gist.github.com/964592
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/