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

@code-to-json/utils

Package Overview
Dependencies
Maintainers
2
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@code-to-json/utils - npm Package Compare versions

Comparing version 1.0.0-rc.5 to 1.0.0-rc.6

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [1.0.0-rc.6](https://github.com/mike-north/code-to-json/compare/@code-to-json/utils@1.0.0-rc.5...@code-to-json/utils@1.0.0-rc.6) (2019-01-29)
### Features
* isNotNull guard ([7ada952](https://github.com/mike-north/code-to-json/commit/7ada952))
# [1.0.0-rc.5](https://github.com/mike-north/code-to-json/compare/@code-to-json/utils@1.0.0-rc.4...@code-to-json/utils@1.0.0-rc.5) (2019-01-28)

@@ -8,0 +19,0 @@

3

lib/src/checks.d.ts

@@ -37,3 +37,4 @@ /**

export declare function isPresent(obj: any): boolean;
export declare function isDefined<T>(t: T | null | undefined): t is T;
export declare function isDefined<T>(t: T | undefined): t is T;
export declare function isNotNull<T>(t: T | null): t is T;
//# sourceMappingURL=checks.d.ts.map

@@ -81,2 +81,6 @@ "use strict";

exports.isDefined = isDefined;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NoZWNrcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQU9BLFNBQVMsR0FBRyxDQUFDLEdBQVEsRUFBRSxRQUFnQjtJQUNyQyxJQUFJLEdBQUcsSUFBSSxPQUFPLEdBQUcsS0FBSyxRQUFRLEVBQUU7UUFDbEMsT0FBTyxHQUFHLENBQUMsUUFBUSxDQUFDLENBQUM7S0FDdEI7SUFDRCxPQUFPLFNBQVMsQ0FBQztBQUNuQixDQUFDO0FBQ0QsSUFBSTtBQUNKOzs7Oz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BUTtJQUM5QixPQUFPLE9BQU8sQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLE9BQU8sR0FBRyxLQUFLLFFBQVEsSUFBSSxJQUFJLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxLQUFLLEtBQUssQ0FBQyxDQUFDO0FBQy9FLENBQUM7QUFGRCwwQkFFQztBQUNEOzs7O0dBSUc7QUFDSCxTQUFnQixTQUFTLENBQUMsR0FBUTtJQUNoQyxPQUFPLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQ3ZCLENBQUM7QUFGRCw4QkFFQztBQUVELFNBQWdCLFNBQVMsQ0FBSSxDQUFnQjtJQUMzQyxPQUFPLE9BQU8sQ0FBQyxLQUFLLFdBQVcsQ0FBQztBQUNsQyxDQUFDO0FBRkQsOEJBRUM7QUFFRCxTQUFnQixTQUFTLENBQUksQ0FBVztJQUN0QyxPQUFPLENBQUMsS0FBSyxJQUFJLENBQUM7QUFDcEIsQ0FBQztBQUZELDhCQUVDIn0=

@@ -5,3 +5,3 @@ export { default as UnreachableError } from './errors/unreachable';

export { Result, ErrorResult, SuccessResult, TextFileReader, FileExistenceChecker } from './types';
export { isBlank, isPresent, isEmpty, isNone, isDefined } from './checks';
export { isBlank, isPresent, isEmpty, isNone, isDefined, isNotNull } from './checks';
export { createQueue, Queue } from './deferred-processing/queue';

@@ -8,0 +8,0 @@ export { Ref, RefFor, AnyRef, refType, refId, isRef, createRef } from './deferred-processing/ref';

@@ -18,2 +18,3 @@ "use strict";

exports.isDefined = checks_1.isDefined;
exports.isNotNull = checks_1.isNotNull;
var queue_1 = require("./deferred-processing/queue");

@@ -30,2 +31,2 @@ exports.createQueue = queue_1.createQueue;

exports.conditionallyMergeTransformed = object_1.conditionallyMergeTransformed;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9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MEJBQUEsT0FBTyxDQUFBO0FBQUUsMEJBQUEsT0FBTyxDQUFBO0FBRXBDLG1DQUFxRjtBQUE1RSwyQkFBQSxPQUFPLENBQUE7QUFBRSw2QkFBQSxTQUFTLENBQUE7QUFBRSwyQkFBQSxPQUFPLENBQUE7QUFBRSwwQkFBQSxNQUFNLENBQUE7QUFBRSw2QkFBQSxTQUFTLENBQUE7QUFBRSw2QkFBQSxTQUFTLENBQUE7QUFDbEUscURBQWlFO0FBQXhELDhCQUFBLFdBQVcsQ0FBQTtBQUNwQixpREFBa0c7QUFBcEUsd0JBQUEsT0FBTyxDQUFBO0FBQUUsc0JBQUEsS0FBSyxDQUFBO0FBQUUsc0JBQUEsS0FBSyxDQUFBO0FBQUUsMEJBQUEsU0FBUyxDQUFBO0FBQzlELHFDQUFvQztBQUEzQiw0QkFBQSxPQUFPLENBQUE7QUFDaEIsbUNBQXlEO0FBQWhELGlEQUFBLDZCQUE2QixDQUFBIn0=
{
"name": "@code-to-json/utils",
"version": "1.0.0-rc.5",
"version": "1.0.0-rc.6",
"description": "Low-level utilities for code-to-json",

@@ -96,3 +96,3 @@ "main": "lib/src/index.js",

},
"gitHead": "6d60b9bc1c62a4617c7b324b13de23995a07cb52"
"gitHead": "adb2b8d7061b141fe8c73a52e86ae924269a2a59"
}

@@ -86,4 +86,8 @@ /**

export function isDefined<T>(t: T | null | undefined): t is T {
export function isDefined<T>(t: T | undefined): t is T {
return typeof t !== 'undefined';
}
export function isNotNull<T>(t: T | null): t is T {
return t !== null;
}

@@ -5,3 +5,3 @@ export { default as UnreachableError } from './errors/unreachable';

export { Result, ErrorResult, SuccessResult, TextFileReader, FileExistenceChecker } from './types';
export { isBlank, isPresent, isEmpty, isNone, isDefined } from './checks';
export { isBlank, isPresent, isEmpty, isNone, isDefined, isNotNull } from './checks';
export { createQueue, Queue } from './deferred-processing/queue';

@@ -8,0 +8,0 @@ export { Ref, RefFor, AnyRef, refType, refId, isRef, createRef } from './deferred-processing/ref';

import { expect } from 'chai';
import { suite, test } from 'mocha-typescript';
import { isBlank, isEmpty, isNone, isPresent } from '../src/checks';
import { isBlank, isDefined, isEmpty, isNone, isNotNull, isPresent } from '../src/checks';

@@ -21,2 +21,30 @@ @suite('Simple predicates')

@test
public 'isNotNull tests'(): void {
expect(isNotNull(0)).to.eql(true);
expect(isNotNull(null)).to.eql(false);
expect(isNotNull(undefined)).to.eql(true);
expect(isNotNull([])).to.eql(true);
expect(isNotNull({ size: 0 })).to.eql(true);
expect(isNotNull({ size: 33 })).to.eql(true);
expect(isNotNull({ length: 0 })).to.eql(true);
expect(isNotNull({ length: 33 })).to.eql(true);
expect(isNotNull((): string => 'foo')).to.eql(true);
expect(isNotNull(new Map([['a', 1]]))).to.eql(true);
}
@test
public 'isDefined tests'(): void {
expect(isDefined(0)).to.eql(true);
expect(isDefined(null)).to.eql(true);
expect(isDefined(undefined)).to.eql(false);
expect(isDefined([])).to.eql(true);
expect(isDefined({ size: 0 })).to.eql(true);
expect(isDefined({ size: 33 })).to.eql(true);
expect(isDefined({ length: 0 })).to.eql(true);
expect(isDefined({ length: 33 })).to.eql(true);
expect(isDefined((): string => 'foo')).to.eql(true);
expect(isDefined(new Map([['a', 1]]))).to.eql(true);
}
@test
public 'isNone tests'(): void {

@@ -23,0 +51,0 @@ expect(isNone(0)).to.eql(false);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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