Detalhes do pacote

@breadstone/ziegel-core

RueDeRennes975MIT0.0.9

Includes core functionality. This package is shared between all other packages.

readme (leia-me)

@breadstone/ziegel-core

MIT License TypeScript npm

The foundation package of the ziegel Enterprise TypeScript Framework. Provides core functionality and utilities powering all other ziegel packages.

Foundation: This package is the backbone of the ziegel ecosystem, delivering essential building blocks for enterprise-grade TypeScript applications.

🚀 Overview

@breadstone/ziegel-core provides:

  • Linq: Powerful LINQ-style querying for arrays and iterables
  • Generic Collections: Queue, Stack, Dictionary, LinkedList, Bag, Heap, Set, KeyValuePair
  • Exception System: Structured exception hierarchy for robust applications
  • Extensions: Extension methods for Array, String, Number, Date
  • Color System: Color manipulation and conversion in various color spaces
  • Type Utilities: Advanced TypeScript types and guards
  • Security & Crypto: Hash algorithms and crypto providers
  • Time Management: DateTime, TimeSpan, DateRange
  • Reactive Patterns: Disposables, Events, Observables

📦 Installation

npm install @breadstone/ziegel-core
# or
yarn add @breadstone/ziegel-core

🧩 Features & Examples

Linq

import { linq } from '@breadstone/ziegel-core';

const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const sum = linq(numbers)
  .where(x => x % 2 === 0)
  .select(x => x * 2)
  .sum();

Available operations:

  • Filtering: where, distinct, except, intersect, union
  • Projection: select, selectMany, map, flatMap
  • Aggregation: aggregate, sum, average, min, max, count
  • Ordering: orderBy, orderByDescending, thenBy, reverse
  • Partitioning: take, skip, takeWhile, skipWhile, first, last, single
  • Set Operations: concat, merge, repeat, defaultIfEmpty
  • Grouping: groupBy, join, groupJoin
  • Resolution: toArray, toMap, asArray, joinStrings

Collections

import { Queue, Stack, Dictionary, LinkedList } from '@breadstone/ziegel-core';
const queue = new Queue<string>();
queue.enqueue('first');
queue.enqueue('second');
const item = queue.dequeue(); // 'first'

const stack = new Stack<number>();
stack.push(1);
stack.push(2);
const top = stack.pop(); // 2

const dict = new Dictionary<string, number>();
dict.add('one', 1);
const value = dict.get('one');

Extensions

import '@breadstone/ziegel-core/Extensions';
[1,2,3].shuffle();
'Hello World'.capitalize();
(3.14159).round(2);
(new Date()).addDays(7);

Color System

import { Color, Colors } from '@breadstone/ziegel-core';
const red = Color.fromRgb(255,0,0);
const lighter = red.lighten(0.2);
const complement = red.complement();

Exception System

import { ArgumentNullException, NotImplementedException } from '@breadstone/ziegel-core';
throw new ArgumentNullException('param');
throw new NotImplementedException();

📚 Package import points

import {
    // Collections
    Bag, Heap, IIndexer, INumberIndexer, IStringIndexer, KeyValuePair,
    LinkedList, Queue, Set, Stack,

    // Decorators
    Delay, Memoize,

    // Diagnostics
    Stopwatch,

    // Events
    EventArgs, IEventArgs, ValueEventArgs, Event, EventInvoker, IEventCallback,

    // Exceptions
    ArgumentException, ArgumentFormatException, ArgumentNullException,
    ArgumentOutOfRangeException, ArgumentTypeException, DuplicateKeyException,
    Exception, IndexOutOfRangeException, InvalidOperationException,
    KeyNotFoundException, NotFoundException, NotImplementedException,
    NotSupportedException, NullReferenceException, OverflowException,

    // Extensions
    AnyExtensions, ArrayExtensions, ColorExtensions, DateExtensions,
    FunctionConstructorExtensions, FunctionExtensions, MapExtensions,
    NumberConstructorExtensions, NumberExtensions, ObjectExtensions,
    StringConstructorExtensions, StringExtensions,

    // Formatting
    FormatException, Formats, IFormat, IFormatProvider, IFormattable, IStandardFormatter,

    // Core Interfaces
    IConstructable, IDisposable, IEquatable, IObservable, IObserver, IStringable, ISupport,

    // LINQ2
    linq, // and all LINQ operations

    // Measurement
    Range, IRange, NumberRange, RangeLike, isRangeLike,

    // Media & Colors
    Color, Colors, CMYK, isCMYK, HSB, isHSB, HSL, isHSL, ICMYK, IHSB, IHSL,
    IRGB, IYUV, RGB, isRGB, YUV, isYUV,

    // Objects
    Console, Defaults, Enum, Guid, Lazy, Random, Version,

    // Reactive
    AnonymousDisposable, CompositeDisposable, Disposable, ICancelable,

    // Resources
    registerResource, SR,

    // RxJS Extensions
    fromDisposable, ObservableLike, isObservableLike,

    // Security
    HashAlgorithm, MD5, MD5CryptoServiceProvider, SHA1, SHA1CryptoServiceProvider,

    // Text
    RegexPatterns, StringBuilder, StringFormatter,

    // Threading
    Deferred,

    // Time
    DateRange, DateTime, DateTimeKind, DateTimeRange, DAY_OF_WEEK, DayOfWeek,
    DAY_OF_WEEK_NAMES, DayOfWeekName, ITimeSpan, Month, TimeSpan, TimeSpanRange,

    // Timers
    Interval,

    // Types
    Action, Action1, Action2, Action3, Action4, Action5, Action6, Action7, Action8,
    Class, isClass, Constructor, isConstructor, DeepPartial, DeepRequired, Diff,
    Func, Func1, Func2, Func3, Func4, Func5, Func6, Func7, Func8,
    Indexable, JsonArray, JsonObject, JsonPrimitive, JsonValue, MatchingKeys,
    MemberLaves, MemberPaths, Merge, NonEmptyArray, isNonEmptyArray,
    Nullable, isNotNullable, isNullable, otherwiseNullable, Omit,
    NonOptional, NonUndefined, Optional, Undefinable, isNotOptional,
    isNotUndefined, isOptional, isUndefined, optionalOtherwise,
    Overwrite, Predicate, Prototypeable, isPrototypeable,
    ReturnValueConstraint, ReturnValueErrorConstraint, Unwrap, WithRequired,

    // Utilities & Validation
    Guard, panic, TypeGuard, using, PasswordScore, PasswordStrengthValidator
} from '@breadstone/ziegel-core';

📚 API Documentation

For details, see the generated API docs or the source code.

License

MIT

Issues

Please report bugs and feature requests in the issue tracker.


Part of the ziegel Enterprise TypeScript Framework