10.7.0 • Published 4 years ago

@standard-software/parts v10.7.0

Weekly downloads
292
License
MIT
Repository
github
Last release
4 years ago

Parts.js

JavaScript Code Parts TypeSafe Library Compatible with many js platform

URL

GitHub

standard-software/partsjs: JavaScript Code Parts
https://github.com/standard-software/partsjs

npm

@standard-software/parts - npm
https://www.npmjs.com/package/@standard-software/parts

Support platform

  • Node.js
  • Deno
  • Major Web Browser
    • Chrome
    • Edge
    • firefox
    • Opera
    • Vivaldi
    • IE11
  • Google Apps Script
    • Google SpreadSheet
    • V8
    • Rhino
  • Windows Scripting Host (WSH)
    • revive support wsh Parts.js ver 10.x after
    • not support wsh Parts.js ver 6.x / 9.x
    • support wsh Parts.js ver 8.x / 7.x / 5.x before

How to use parts.js in Node.js

npm install

Normal

npm i @standard-software/parts

When specifying the version

npm i @standard-software/parts@10.7.0
npm i @standard-software/parts@9.2.0

type CommonJS

// index.js
const parts = require("@standard-software/parts");

console.log(
  'parts version is ', parts.VERSION
);
node index.js

type ES Modules

// index.mjs
import parts from '@standard-software/parts';

console.log(
  'parts version is ', parts.VERSION
);
node --experimental-modules index.mjs

refer to example

  • partsjs/run_check/node_release/
  • partsjs/test/build/

How to use parts.js in Deno

local

// index.js
import parts from './source/index.js';

console.log(
  'parts version is ', parts.VERSION
);
deno run index.js

web

// index.js
import parts from 'https://raw.githubusercontent.com/standard-software/partsjs/v10.7.0/source/index.js';

console.log(
  'parts version is ', parts.VERSION
);
deno run index.js

refer to example

  • partsjs/run_check/deno_local/
  • partsjs/run_check/deno_web/
  • partsjs/test/source/

How to use parts.js in HTML page

HTML file

<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
</head>
<body>
  <script src="./release_build/parts.js"></script>
  <script>
    document.write('parts version is ' + parts.VERSION)
  </script>
</body>

You can now use the functions of the parts.js object.

HTML file CDN

<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
</head>
<body>
  <script src="https://cdn.jsdelivr.net/npm/@standard-software/parts@10.7.0"></script>
  <script>
    document.write('parts version is ' + parts.VERSION)
  </script>
</body>

You can now use the functions of the parts.js object.

refer to example

RunKit + npm

https://npm.runkit.com/%40standard-software%2Fparts

var parts = require("@standard-software/parts")
console.log('parts version is ', parts.VERSION);

JSBin CDN

https://jsbin.com/popuhog/edit?html,js,console

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/@standard-software/parts@10.7.0"></script>

</body>
</html>
console.log('parts version is ' + parts.VERSION)

How to use parts.js in Google Apps Script for Rhino and V8

access Google Apps Script Home

https://script.google.com/home

create new Project

  • input name for example parts.js test
  • menu filescript file
  • input parts and created parts.gs file
  • Please copy and paste ./release_build/parts.js to parts.gs

  • project

    • code.gs
    • parts.gs

code.gs

// code.gs
function myFunction() {
  console.log('parts version is ' + parts.VERSION);
}

You can now use the functions of the parts.js object.

To see console.log execution results

Google Apps Script Home parts.js testmy function

support V8

update manifest file

// appsscript.json
{
  "timeZone": "Asia/Tokyo",
  "dependencies": {
  },
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8"
}
// code.gs
function myFunction() {
  outputFunction = () => {
    return 'parts version is ' + parts.VERSION
  }
  console.log(outputFunction());
}

V8 engine support arrow function.

You can now use the functions of the parts.js object.

How to use parts.js in Google SpreadSheet

same How to use Google Apps Script

access Google SpreadSheet

create new script

  • spreadsheet menu tool

open google apps script project

You can copy and paste ./release_build/parts.js code into parts.gs

  • project
    • code.gs
    • parts.gs

code.gs

// code.gs
function myFunction() {
  console.log('parts version is ' + parts.VERSION);
  Browser.msgBox('parts version is ' + parts.VERSION);
}

run and see sheet page.

more write add code.gs

function onOpen() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var entries = [
    {
      name : "execute myFunction",
      functionName : "myFunction"
    }
  ];
  sheet.addMenu("run script", entries);
};

function myFunction() {
  console.log('parts version is ' + parts.VERSION);
  Browser.msgBox('parts version is ' + parts.VERSION);
}

support V8

same How to use Google Apps Script

How to use parts.js in WSH (Windows Scripting Host .wsf file)

refer to example

  • partsjs/run_check/wsh/
  • partsjs/test/release/wsh/

wsf file (ex. index.wsf)

<?xml version="1.0" encoding="shift-jis" ?>

<job>
<script language="JavaScript">
<![CDATA[

  var outputMessage = '';
  var console = {
    log: function() {
      var args = Array.prototype.slice.call(arguments);
      for (var i = 0; i < args.length; i += 1) {
        outputMessage += args[i];
        outputMessage += '\n'
      }
    }
  };

  var module = {};
]]>
</script>
<script language="JavaScript" src="./polyfill_Object_defineProperty.js"></script>
<script language="JavaScript" src="../../release_wsh/1.parts.js"></script>
<script language="JavaScript" src="../../release_wsh/2.parts.js"></script>
<script language="JavaScript" src="../../release_wsh/parts.js"></script>

<script language="JavaScript">
<![CDATA[

  console.log('test_index.wsf\n\n');
  console.log(parts.VERSION);

  WScript.Echo(outputMessage);

]]>
</script>
</job>

You can now use the functions of the parts.js object.

Version

10.7.0

2021/06/19(Sat)

  • add getDatetime / getDatetimeUTC
  • add getTimezoneOffset
  • update Year() / Month() / Day() / dateToString() / stringToDate() / Datetime()
    • support timezoneOffset seconds
  • update Jest test code
    • support invalid date
    • update jest.config.js

10.6.1

2021/06/15(Tue)

  • update dateToString
    • update default timezone
    • update __dateToStringRule.js
    • bugfix _minutesToTexts GMT-0230 or GMT-0930

10.6.0

2021/06/14(Mon)

  • add date.strintToDate date.stringToDateUTC
    • add stringToDateRule
    • support full object parameter
    • support timezone
  • rename DateTime to Datetime
    • update inside
    • support timezone
  • add DatetimeUTC
  • rename datetimeToString >> dateToString
    • rename detetomeToStringFunc >> dateToStringRule
    • rename dateToString.func >> dateToString.rule
    • add function dateToStringUTC
    • support timezone
  • update equal support Invalid Date
  • add date.InvalidDate()
  • add function
    • Year/YearUTC
    • Month/MonthUTC
    • Day/DayUTC
  • update test code date
    • support timezone
  • delete
    • Today >> replace Day('today')
    • dayOfWeekEnglishShort / dayOfWeekEnglishLong
    • dayOfWeekJapaneseShort / dayOfWeekJapaneseLong
    • nameOfMonthEnglishChar3 / Char4 / Long
  • add date.minutesToTexts
  • add date.textsToMinutes
  • update replaceAllArray add args detail
  • update number string convert testcode
  • update parseInt testCode
  • add string.escapeRegExp
  • add checkNotEqual
  • update instanceof code
  • update test for deno for node
    • Reflect
    • Intl

10.5.0

2021/03/29(Mon)

  • update round
    • support full object parameter
  • add roundUp / roundDown
    • webpack for wsh build size change
  • update replaceAllRepeat
    • support args maxCount repeat
  • update bugfix datetimeToString timezone string

10.4.1

2021/01/20(Wed)

  • update testcode build
  • update package
    • babel
    • webpack
    • etc...

10.4.0

2021/01/10(Sun)

  • update replaceAll
    • support full object parameter
  • add replaceAllRepeat
    • add _replaceAllRepeat.js replaceAllRepeat.js
  • add string.includeCount
    • add _includeCount.js includeCount.js
  • add datetimeToString
  • add dayOfWeek
    • dayOfWeek
    • dayOfWeekEnglishShort / dayOfWeekEnglishLong
    • dayOfWeekJapaneseShort / dayOfWeekJapaneseLong
  • add nameOfMonth
    • nameOfMonth.js
    • nameOfMonthEnglishChar3 / Char4 / Long
  • update build for WSH
    • EncodingPlugin UTF-16LE for Japanese Support
    • update testCode about Zenkaku Space

10.3.0

2020/12/09(Wed)

  • add isPrimitiveType / isReferenceType
    • add isPrimitiveType.js / isReferenceType.js
  • update setProperty
    • support objectLike (array function etc)
  • update testCode
    • update equalDeepUseRecursive
    • update cloneDeepUseRecursive
  • from getProperty.js add _getProperty.js
  • from object_common.js
    • add _setProperty.js / setProperty.js
    • add _copyProperty.js / copyProperty.js
  • update package.json scripts
  • update .eslintrc.js
  • update testcode bigint etc
  • update merge
    • support deep merge
    • update testcode
  • rename returnValueFunction >> returnFirstArgFunc
    • add __returnSecondArgFunc

More Info

VERSION.md

10.7.0

4 years ago

10.6.0

4 years ago

10.6.1

4 years ago

10.5.0

4 years ago

10.4.1

4 years ago

10.4.0

5 years ago

10.3.0

5 years ago

10.2.0

5 years ago

10.1.0

5 years ago

10.0.0

5 years ago

9.2.0

5 years ago

9.1.0

5 years ago

9.0.0

5 years ago

8.4.0

5 years ago

8.3.0

5 years ago

8.2.0

5 years ago

8.1.0

5 years ago

8.0.0

5 years ago

7.6.0

5 years ago

7.5.0

5 years ago

7.4.0

5 years ago

7.3.0

5 years ago

7.2.0

5 years ago

7.1.1

5 years ago

7.1.0

5 years ago

7.0.0

5 years ago

6.5.0

5 years ago

6.4.0

5 years ago

6.3.0

5 years ago

6.2.0

5 years ago

6.1.0

5 years ago

6.0.0

5 years ago

5.8.2

5 years ago

5.8.1

5 years ago

5.8.0

5 years ago

5.7.0

5 years ago

5.6.0

5 years ago

5.5.0

5 years ago

5.4.0

5 years ago

5.3.3

5 years ago

5.3.2

5 years ago

5.3.1

5 years ago

5.3.0

5 years ago

5.2.1

5 years ago

5.2.0

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.10.1

5 years ago

4.10.0

5 years ago

4.9.2

5 years ago

4.9.1

5 years ago

4.9.0

5 years ago

4.8.0

5 years ago

4.7.0

5 years ago

4.6.1

5 years ago

4.6.0

5 years ago

4.5.0

5 years ago

4.4.1

5 years ago

4.4.0

5 years ago

4.3.0

5 years ago

4.2.0

5 years ago

4.1.0

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.5.0

5 years ago

3.4.0

6 years ago

3.3.0

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.12.0

6 years ago

2.11.0

6 years ago

2.10.2

6 years ago

2.10.1

6 years ago

2.9.1

6 years ago

2.9.0

6 years ago

2.8.0

6 years ago

2.7.0

6 years ago

2.6.2

6 years ago

2.6.1

6 years ago

2.6.0

6 years ago

2.5.3

6 years ago

2.5.2

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.0

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

0.9.0

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago