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

@xslet/datatype

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xslet/datatype

Defines data types used in xslet packages.

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@xslet/datatype Github.io NPM version MIT License Coverage Status

Defines data types and utilities used in xslet packages.

Install

Install from npm

Executes following command to install this package from npm.

$ npm install --save @xslet/datatype

Load this package in a browser

<script src="xslet.datatype.min.js"></script>

Usage

Rect

var Rect = xslet.datatype.Rect;

Rect rect = Rect({ left: 10, top: 20, width: 100, height: 50 })

console.log(rect)
// => { left: 10, top: 20, right: 90, bottom: 30, width: 100, height: 50 }

console.log(rect.right)
// => 110

rect.top = 30
rect.bottom = 200

console.log(rect)
// => { left: 10, top: 30, right: 90, bottom: 200, width: 100, height: 170 }

APIs

Rect

Represents a rectangle.

Each of .right and .width properties are calculated automatically with another properties and .left. As well as each of .bottom and .height properties are calculated automatically with another properties and .top.

When .left and .top properties are changed, the rectangle is moved and .width and .height are not changed.

The unit of this value is not specified. In xslet package, it would be determined by xslet.window.unitOfSize.

Properties:

  • .top {number} - The top position of this rectangle.
  • .left {number} - The left position of this rectangle.
  • .right {number} - The right position of this rectangle.
  • .bottom {number} - The bottom position of this rectangle.
  • .width {number} - The width position of this rectangle.
  • .height {number} - The height position of this rectangle.

Constructor:

  • Rect()

    Creates a Rect object of which all properties is zero.

  • Rect(obj)

    Creates a Rect object of which properties are corner positions or size of a rectangle.

    Parameters:

    • obj {object}

      An object which supposed to have either or all following properties: .left, .top, .right, .bottom, .width and .height. If all .left, .right and .width properties are specified but .width is different from .right - .left, .right is changed to .left + .width. It is also same about .top, .bottom and .height.

Behavior checks on browsers

Show this page: https://xslet.github.io/datatype/test.html.

License

Copyright (C) 2016-2019 Takayuki Sato

This program is free software under MIT License. See the file LICENSE in this distribution for more details.

Keywords

FAQs

Package last updated on 04 May 2020

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