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

chai-null

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-null

Null Object Pattern implementation for the Chai Assertion Library

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-76.92%
Maintainers
1
Weekly downloads
 
Created
Source

Chai Null

This is a addon plugin for the Chai Assertion Library. It is simple implementation of Null Object Pattern for Node.js and the browser.

Installation

Node.js
  $ npm install chai-null
Browser

Include chai-null.js after including chai.js.

<script src="chai-null.js"></script>

Plug In

If you are using chai-null in the browser, there is nothing you need to do. It will detect chai in the global namespace and automagically get used.

If you are using node, here is a useful bit.

var chai = require('chai')
  , nil = require('chai-null');

chai.use(nil);

Building for the Browser

If you are developing an addon for chai, one thing you might find useful is the contents of the support folder. This directly contains everything that is needed to package all js files in a directory for browser use. Provided there are no external dependencies, everything will be packaged and wrapped with a CommonJS require style loader by folio, a small JS packaging tool. Please consult the comments in support/compile.js.

Usage

Build object from scratch:
var nullobject = chai.Null().method('foo').method('bar').create();
Build object with null properties and methods that just return null:

Class:

var nullobject = chai.Null(Klass).create();

Object:

var nullobject = chai.Null(obj).create();

Tests

Tests are written using mocha. Node tests can be executed using make test. Browser tests can be seen by opening test/browser/index.html.

License

(The MIT License)

Copyright (c) Veselin Todorov hi@vesln.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

FAQs

Package last updated on 30 Apr 2012

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