Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cruddy

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cruddy

Observable Objects for the laggards

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

CruddyJS - Observable Objects for the laggards

Observe changes to native JavaScript objects with CruddyJS. Based on the EcmaScript Harmony proposal, CruddyJS will send change updates when object values change. Here's how it works.

var observer = cruddy({ foo: 'bar' }, function (changes) {
 console.log(changes);
})

observer.update(function (o) {
 o.set('foo', 'boo')
})

> {
 type: 'update',
 name: 'foo',
 object: { foo: 'boo' },
 oldValue: 'bar'
}

Does your browser already support Object.observe? No problem, CruddyJS simply uses the native functionality.

Installation

NodeJS

npm install cruddy

API

Depending on the type of class passed to CruddyJS, you will get one of two interfaces. For basic Object classes you will receive a Model. For Array classes you will receive a Collection.

Model

cruddy({ foo: 'bar' }, callback)
.update(function (model) {
  model.set('bar', 'foo')
  model.destroy('foo', 'bar')
})
Methods
  • get
  • set
  • destroy

Collection

cruddy([1, 3, 2], callback)
.update(function (collection) {
  collection.push(0, 4, 5)
  collection.shift()
  collection.sort()
})
Methods
  • concat
  • length
  • get
  • join
  • set
  • push
  • pop
  • reverse
  • shift
  • splice
  • unshift

EcmaScript 6+

  • forEach
  • indexOf
  • fill
  • lastIndexOf
  • map
  • reduce
  • reduceRight
  • some

FAQs

Package last updated on 30 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc