Socket
Socket
Sign inDemoInstall

@thi.ng/api

Package Overview
Dependencies
Maintainers
1
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/api - npm Package Compare versions

Comparing version 6.3.3 to 6.4.0

1

api.d.ts

@@ -101,2 +101,3 @@ export declare const DEFAULT_EPS = 0.000001;

export declare type NumericArray = number[] | TypedArray;
export declare type Nullable<T> = T | null | undefined;
export declare type Primitive = number | string | boolean | symbol;

@@ -103,0 +104,0 @@ /**

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

# [6.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.3.3...@thi.ng/api@6.4.0) (2019-09-21)
### Features
* **api:** add Nullable ([8366223](https://github.com/thi-ng/umbrella/commit/8366223))
## [6.3.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.3.2...@thi.ng/api@6.3.3) (2019-08-21)

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

14

lib/index.js

@@ -151,13 +151,11 @@ 'use strict';

enable() {
const $this = this;
$this._enabled = true;
if ($this.notify) {
$this.notify({ id: EVENT_ENABLE, target: this });
this._enabled = true;
if (this.notify) {
this.notify({ id: EVENT_ENABLE, target: this });
}
},
disable() {
const $this = this;
$this._enabled = false;
if ($this.notify) {
$this.notify({ id: EVENT_DISABLE, target: this });
this._enabled = false;
if (this.notify) {
this.notify({ id: EVENT_DISABLE, target: this });
}

@@ -164,0 +162,0 @@ },

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@thi.ng/errors")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/errors"],t):t(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.api={}),e.thi.ng.errors)}(this,function(e,t){"use strict";const i=Symbol(),n=()=>{};var s;(s=e.Type||(e.Type={}))[s.U8=0]="U8",s[s.U8C=1]="U8C",s[s.I8=2]="I8",s[s.U16=3]="U16",s[s.I16=4]="I16",s[s.U32=5]="U32",s[s.I32=6]="I32",s[s.F32=7]="F32",s[s.F64=8]="F64";const o={0:1,1:1,2:1,3:2,4:2,5:4,6:4,7:4,8:8};var r;(r=e.LogLevel||(e.LogLevel={}))[r.FINE=0]="FINE",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.SEVERE=4]="SEVERE",r[r.NONE=5]="NONE";const l="undefined"==typeof process||"production"!==process.env.NODE_ENV||"1"===process.env.UMBRELLA_ASSERTS?(e,t="assertion failed")=>{if("function"==typeof e&&!e()||!e)throw new Error("function"==typeof t?t():t)}:n,a=Object.freeze({level:e.LogLevel.NONE,fine(){},debug(){},info(){},warn(){},severe(){}});const c=(e,t={})=>{const i=Reflect.ownKeys(e),n=Reflect.ownKeys(t),s=Symbol("isa");function o(t){for(let n of i){const i=Object.getOwnPropertyDescriptor(t.prototype,n);!i||i.configurable?Object.defineProperty(t.prototype,n,{value:e[n],writable:!0}):console.log(`not patching: ${t.name}.${n.toString()}`)}return Object.defineProperty(t.prototype,s,{value:!0}),t}for(let e of n)Object.defineProperty(o,e,{value:t[e],enumerable:t.propertyIsEnumerable(e)});return Object.defineProperty(o,Symbol.hasInstance,{value:e=>!!e[s]}),o},h=c({_enabled:!0,isEnabled(){return this._enabled},enable(){const e=this;e._enabled=!0,e.notify&&e.notify({id:"enable",target:this})},disable(){const e=this;e._enabled=!1,e.notify&&e.notify({id:"disable",target:this})},toggle(){return this._enabled?this.disable():this.enable(),this._enabled}}),f=(e,t)=>{if(e)for(let i,n=0,s=e.length;n<s;n++)if((i=e[n])[0].call(i[1],t),t.canceled)return},u=c({addListener(e,t,i){let n=(this._listeners=this._listeners||{})[e];return n||(n=this._listeners[e]=[]),-1===this.__listener(n,t,i)&&(n.push([t,i]),!0)},removeListener(e,t,i){if(!this._listeners)return!1;const n=this._listeners[e];if(n){const e=this.__listener(n,t,i);if(-1!==e)return n.splice(e,1),!0}return!1},notify(e){this._listeners&&(void 0===e.target&&(e.target=this),f(this._listeners[e.id],e),f(this._listeners["*"],e))},__listener(e,t,i){let n=e.length;for(;--n>=0;){const s=e[n];if(s[0]===t&&s[1]===i)break}return n}}),E=c({addWatch(e,t){return this._watches=this._watches||{},!this._watches[e]&&(this._watches[e]=t,!0)},removeWatch(e){if(this._watches)return!!this._watches[e]&&(delete this._watches[e],!0)},notifyWatches(e,t){if(!this._watches)return;const i=this._watches;for(let n in i)i[n](n,e,t)}});e.ConsoleLogger=class{constructor(t,i=e.LogLevel.FINE){this.id=t,this.level=i}fine(...t){this.level<=e.LogLevel.FINE&&this.log("FINE",t)}debug(...t){this.level<=e.LogLevel.DEBUG&&this.log("DEBUG",t)}info(...t){this.level<=e.LogLevel.INFO&&this.log("INFO",t)}warn(...t){this.level<=e.LogLevel.WARN&&this.log("WARN",t)}severe(...t){this.level<=e.LogLevel.SEVERE&&this.log("SEVERE",t)}log(e,t){console.log(`[${e}] ${this.id}:`,...t)}},e.DEFAULT_EPS=1e-6,e.EVENT_ALL="*",e.EVENT_DISABLE="disable",e.EVENT_ENABLE="enable",e.IEnableMixin=h,e.INotifyMixin=u,e.IWatchMixin=E,e.NO_OP=n,e.NULL_LOGGER=a,e.SEMAPHORE=i,e.SIZEOF=o,e.assert=l,e.configurable=e=>(function(t,i,n){n.configurable=e}),e.deprecated=(e,i=console.log)=>(function(n,s,o){const r=`${n.constructor.name}#${s.toString()}`,l=o.value;return"function"!=typeof l&&t.illegalArgs(`${r} is not a function`),o.value=function(){return i(`DEPRECATED ${r}: ${e||"will be removed soon"}`),l.apply(this,arguments)},o}),e.inotify_dispatch=f,e.iterable=e=>c({*[Symbol.iterator](){yield*this[e]}}),e.mixin=c,e.nomixin=(e,t,i)=>{i.configurable=!1},e.sealed=e=>{Object.seal(e),Object.seal(e.prototype)},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@thi.ng/errors")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/errors"],t):t(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.api={}),e.thi.ng.errors)}(this,function(e,t){"use strict";const i=Symbol(),n=()=>{};var s;(s=e.Type||(e.Type={}))[s.U8=0]="U8",s[s.U8C=1]="U8C",s[s.I8=2]="I8",s[s.U16=3]="U16",s[s.I16=4]="I16",s[s.U32=5]="U32",s[s.I32=6]="I32",s[s.F32=7]="F32",s[s.F64=8]="F64";const o={0:1,1:1,2:1,3:2,4:2,5:4,6:4,7:4,8:8};var r;(r=e.LogLevel||(e.LogLevel={}))[r.FINE=0]="FINE",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.SEVERE=4]="SEVERE",r[r.NONE=5]="NONE";const l="undefined"==typeof process||"production"!==process.env.NODE_ENV||"1"===process.env.UMBRELLA_ASSERTS?(e,t="assertion failed")=>{if("function"==typeof e&&!e()||!e)throw new Error("function"==typeof t?t():t)}:n,a=Object.freeze({level:e.LogLevel.NONE,fine(){},debug(){},info(){},warn(){},severe(){}});const h=(e,t={})=>{const i=Reflect.ownKeys(e),n=Reflect.ownKeys(t),s=Symbol("isa");function o(t){for(let n of i){const i=Object.getOwnPropertyDescriptor(t.prototype,n);!i||i.configurable?Object.defineProperty(t.prototype,n,{value:e[n],writable:!0}):console.log(`not patching: ${t.name}.${n.toString()}`)}return Object.defineProperty(t.prototype,s,{value:!0}),t}for(let e of n)Object.defineProperty(o,e,{value:t[e],enumerable:t.propertyIsEnumerable(e)});return Object.defineProperty(o,Symbol.hasInstance,{value:e=>!!e[s]}),o},c=h({_enabled:!0,isEnabled(){return this._enabled},enable(){this._enabled=!0,this.notify&&this.notify({id:"enable",target:this})},disable(){this._enabled=!1,this.notify&&this.notify({id:"disable",target:this})},toggle(){return this._enabled?this.disable():this.enable(),this._enabled}}),f=(e,t)=>{if(e)for(let i,n=0,s=e.length;n<s;n++)if((i=e[n])[0].call(i[1],t),t.canceled)return},u=h({addListener(e,t,i){let n=(this._listeners=this._listeners||{})[e];return n||(n=this._listeners[e]=[]),-1===this.__listener(n,t,i)&&(n.push([t,i]),!0)},removeListener(e,t,i){if(!this._listeners)return!1;const n=this._listeners[e];if(n){const e=this.__listener(n,t,i);if(-1!==e)return n.splice(e,1),!0}return!1},notify(e){this._listeners&&(void 0===e.target&&(e.target=this),f(this._listeners[e.id],e),f(this._listeners["*"],e))},__listener(e,t,i){let n=e.length;for(;--n>=0;){const s=e[n];if(s[0]===t&&s[1]===i)break}return n}}),E=h({addWatch(e,t){return this._watches=this._watches||{},!this._watches[e]&&(this._watches[e]=t,!0)},removeWatch(e){if(this._watches)return!!this._watches[e]&&(delete this._watches[e],!0)},notifyWatches(e,t){if(!this._watches)return;const i=this._watches;for(let n in i)i[n](n,e,t)}});e.ConsoleLogger=class{constructor(t,i=e.LogLevel.FINE){this.id=t,this.level=i}fine(...t){this.level<=e.LogLevel.FINE&&this.log("FINE",t)}debug(...t){this.level<=e.LogLevel.DEBUG&&this.log("DEBUG",t)}info(...t){this.level<=e.LogLevel.INFO&&this.log("INFO",t)}warn(...t){this.level<=e.LogLevel.WARN&&this.log("WARN",t)}severe(...t){this.level<=e.LogLevel.SEVERE&&this.log("SEVERE",t)}log(e,t){console.log(`[${e}] ${this.id}:`,...t)}},e.DEFAULT_EPS=1e-6,e.EVENT_ALL="*",e.EVENT_DISABLE="disable",e.EVENT_ENABLE="enable",e.IEnableMixin=c,e.INotifyMixin=u,e.IWatchMixin=E,e.NO_OP=n,e.NULL_LOGGER=a,e.SEMAPHORE=i,e.SIZEOF=o,e.assert=l,e.configurable=e=>(function(t,i,n){n.configurable=e}),e.deprecated=(e,i=console.log)=>(function(n,s,o){const r=`${n.constructor.name}#${s.toString()}`,l=o.value;return"function"!=typeof l&&t.illegalArgs(`${r} is not a function`),o.value=function(){return i(`DEPRECATED ${r}: ${e||"will be removed soon"}`),l.apply(this,arguments)},o}),e.inotify_dispatch=f,e.iterable=e=>h({*[Symbol.iterator](){yield*this[e]}}),e.mixin=h,e.nomixin=(e,t,i)=>{i.configurable=!1},e.sealed=e=>{Object.seal(e),Object.seal(e.prototype)},Object.defineProperty(e,"__esModule",{value:!0})});

@@ -15,13 +15,11 @@ import { EVENT_DISABLE, EVENT_ENABLE } from "../api";

enable() {
const $this = this;
$this._enabled = true;
if ($this.notify) {
$this.notify({ id: EVENT_ENABLE, target: this });
this._enabled = true;
if (this.notify) {
this.notify({ id: EVENT_ENABLE, target: this });
}
},
disable() {
const $this = this;
$this._enabled = false;
if ($this.notify) {
$this.notify({ id: EVENT_DISABLE, target: this });
this._enabled = false;
if (this.notify) {
this.notify({ id: EVENT_DISABLE, target: this });
}

@@ -28,0 +26,0 @@ },

{
"name": "@thi.ng/api",
"version": "6.3.3",
"version": "6.4.0",
"description": "Common, generic types & interfaces for thi.ng projects",

@@ -59,3 +59,3 @@ "module": "./index.js",

"sideEffects": false,
"gitHead": "161b4f8afaef0df742a8e2c7776993b828662589"
"gitHead": "5f865588e37a27ceb46484c24fce4d59a0637f90"
}

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