LoginSignup
4
3

More than 5 years have passed since last update.

Node.jsで$.extendを使いたい!!!

Posted at

$.extendさんには、散々お世話になりましたが、Node.jsじゃjQueryが使えません(サーバーサイドでは)。

extendモジュールなら、jQueryの$.extendと同じように使えます

インストール


npm install extend

使い方はjQueryと同じ🎶

//fooをbarにコピーして、barのほうだけ値をいぢる

var extend = require("extend");
var foo = {a:1,b:2}
var bar = extend({},foo);

bar.a=2;

console.log(foo,bar)


結果{ a: 1, b: 2} { a: 2, b: 2}

ドキュメントはここ

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3